This commit is contained in:
Anuken
2021-01-11 16:07:46 -05:00
parent 912ea94828
commit 0cbc4c0cc5
2 changed files with 31 additions and 30 deletions

View File

@ -224,7 +224,7 @@ public class HudFragment extends Fragment{
int i = 0; int i = 0;
for(Team team : Team.baseTeams){ for(Team team : Team.baseTeams){
ImageButton button = teams.button(Tex.whiteui, Styles.clearTogglePartiali, 40f, () -> Call.setPlayerTeamEditor(player, team)) ImageButton button = teams.button(Tex.whiteui, Styles.clearTogglePartiali, 40f, () -> Call.setPlayerTeamEditor(player, team))
.size(50f).margin(6f).get(); .size(50f).margin(6f).get();
button.getImageCell().grow(); button.getImageCell().grow();
button.getStyle().imageUpColor = team.color; button.getStyle().imageUpColor = team.color;
button.update(() -> button.setChecked(player.team() == team)); button.update(() -> button.setChecked(player.team() == team));
@ -342,39 +342,39 @@ public class HudFragment extends Fragment{
//TODO DEBUG: rate table //TODO DEBUG: rate table
if(false) if(false)
parent.fill(t -> { parent.fill(t -> {
t.name = "rates"; t.name = "rates";
t.bottom().left(); t.bottom().left();
t.table(Styles.black6, c -> { t.table(Styles.black6, c -> {
Bits used = new Bits(content.items().size); Bits used = new Bits(content.items().size);
Runnable rebuild = () -> { Runnable rebuild = () -> {
c.clearChildren(); c.clearChildren();
for(Item item : content.items()){ for(Item item : content.items()){
if(state.rules.sector != null && state.rules.sector.info.getExport(item) >= 1){ if(state.rules.sector != null && state.rules.sector.info.getExport(item) >= 1){
c.image(item.icon(Cicon.small)); c.image(item.icon(Cicon.small));
c.label(() -> (int)state.rules.sector.info.getExport(item) + " /s").color(Color.lightGray); c.label(() -> (int)state.rules.sector.info.getExport(item) + " /s").color(Color.lightGray);
c.row(); c.row();
}
} }
} };
};
c.update(() -> { c.update(() -> {
boolean wrong = false; boolean wrong = false;
for(Item item : content.items()){ for(Item item : content.items()){
boolean has = state.rules.sector != null && state.rules.sector.info.getExport(item) >= 1; boolean has = state.rules.sector != null && state.rules.sector.info.getExport(item) >= 1;
if(used.get(item.id) != has){ if(used.get(item.id) != has){
used.set(item.id, has); used.set(item.id, has);
wrong = true; wrong = true;
}
} }
} if(wrong){
if(wrong){ rebuild.run();
rebuild.run(); }
} });
}); }).visible(() -> state.isCampaign() && content.items().contains(i -> state.rules.sector != null && state.rules.sector.info.getExport(i) > 0));
}).visible(() -> state.isCampaign() && content.items().contains(i -> state.rules.sector != null && state.rules.sector.info.getExport(i) > 0)); });
});
blockfrag.build(parent); blockfrag.build(parent);
} }
@ -765,6 +765,7 @@ public class HudFragment extends Fragment{
count[0] = payload.payloadUsed(); count[0] = payload.payloadUsed();
} }
}else{ }else{
count[0] = -1;
t.clear(); t.clear();
} }
}).growX().visible(() -> player.unit() instanceof Payloadc p && p.payloadUsed() > 0).colspan(2); }).growX().visible(() -> player.unit() instanceof Payloadc p && p.payloadUsed() > 0).colspan(2);

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=c55aa1fe790c50db389225d9a2287b57f71260ff archash=78fdeeda71a4bb2d46e81d936beccf8727d95388