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

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

View File

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

View File

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