Implemented core item display (WIP)

This commit is contained in:
Anuken
2020-07-02 15:27:02 -04:00
parent cecb5cf4b4
commit ee3aedc75f
4 changed files with 15 additions and 6 deletions

View File

@@ -683,6 +683,7 @@ setting.blockselectkeys.name = Show Block Select Keys
setting.vsync.name = VSync setting.vsync.name = VSync
setting.pixelate.name = Pixelate setting.pixelate.name = Pixelate
setting.minimap.name = Show Minimap setting.minimap.name = Show Minimap
setting.coreitems.name = Display Core Items (WIP)
setting.position.name = Show Player Position setting.position.name = Show Player Position
setting.musicvol.name = Music Volume setting.musicvol.name = Music Volume
setting.atmosphere.name = Show Planet Atmosphere setting.atmosphere.name = Show Planet Atmosphere

View File

@@ -3,7 +3,6 @@ package mindustry.ui;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.struct.*; import arc.struct.*;
import mindustry.*; import mindustry.*;
import mindustry.gen.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.blocks.storage.CoreBlock.*; import mindustry.world.blocks.storage.CoreBlock.*;
@@ -22,7 +21,8 @@ public class CoreItemsDisplay extends Table{
void rebuild(){ void rebuild(){
clear(); clear();
background(Tex.button); background(Styles.black6);
margin(4);
update(() -> { update(() -> {
CoreEntity core = Vars.player.team().core(); CoreEntity core = Vars.player.team().core();
@@ -40,10 +40,10 @@ public class CoreItemsDisplay extends Table{
CoreEntity core = Vars.player.team().core(); CoreEntity core = Vars.player.team().core();
for(Item item : content.items()){ for(Item item : content.items()){
if(usedItems.contains(item)){ if(usedItems.contains(item)){
image(item.icon(Cicon.medium)).padRight(4); image(item.icon(Cicon.small)).padRight(3);
label(() -> core == null ? "0" : ui.formatAmount(core.items.get(item))).padRight(4); label(() -> core == null ? "0" : ui.formatAmount(core.items.get(item))).padRight(3);
if(++i % 2 == 0){ if(++i % 4 == 0){
row(); row();
} }
} }

View File

@@ -324,6 +324,9 @@ public class SettingsMenuDialog extends SettingsDialog{
graphics.checkPref("destroyedblocks", true); graphics.checkPref("destroyedblocks", true);
graphics.checkPref("blockstatus", false); graphics.checkPref("blockstatus", false);
graphics.checkPref("playerchat", true); graphics.checkPref("playerchat", true);
if(!mobile){
graphics.checkPref("coreitems", false);
}
graphics.checkPref("minimap", !mobile); graphics.checkPref("minimap", !mobile);
graphics.checkPref("smoothcamera", true); graphics.checkPref("smoothcamera", true);
graphics.checkPref("position", false); graphics.checkPref("position", false);

View File

@@ -35,7 +35,6 @@ public class HudFragment extends Fragment{
private Table lastUnlockLayout; private Table lastUnlockLayout;
private boolean shown = true; private boolean shown = true;
private float dsize = 47.2f; private float dsize = 47.2f;
//TODO implement
private CoreItemsDisplay coreItems = new CoreItemsDisplay(); private CoreItemsDisplay coreItems = new CoreItemsDisplay();
private String hudText = ""; private String hudText = "";
@@ -203,6 +202,12 @@ public class HudFragment extends Fragment{
t.top().right(); t.top().right();
}); });
//core items
parent.fill(t -> {
t.top().add(coreItems);
t.visible(() -> Core.settings.getBool("coreitems") && !mobile);
});
//spawner warning //spawner warning
parent.fill(t -> { parent.fill(t -> {
t.touchable(Touchable.disabled); t.touchable(Touchable.disabled);