This commit is contained in:
Anuken
2020-09-14 11:13:27 -04:00
parent 8901838c19
commit d6447cb31a
4 changed files with 35 additions and 10 deletions

Binary file not shown.

View File

@@ -55,9 +55,22 @@ public class Universe{
public void displayTimeEnd(){ public void displayTimeEnd(){
if(!headless){ if(!headless){
state.set(State.paused); //check if any sectors are under attack to display this
Seq<Sector> attacked = state.getSector().planet.sectors.select(s -> s.hasWaves() && s.hasBase() && !s.isBeingPlayed());
ui.announce("Next turn incoming."); if(attacked.any()){
state.set(State.paused);
//TODO localize
String text = attacked.size > 1 ? attacked.size + " sectors attacked." : "Sector " + attacked.first().id + " under attack.";
ui.hudfrag.sectorText = text;
ui.hudfrag.attackedSectors = attacked;
ui.announce(text);
}else{
//autorun next turn
universe.runTurn();
}
} }
} }

View File

@@ -35,6 +35,10 @@ public class HudFragment extends Fragment{
public final PlacementFragment blockfrag = new PlacementFragment(); public final PlacementFragment blockfrag = new PlacementFragment();
//TODO localize
public String sectorText = "Out of sector time.";
public Seq<Sector> attackedSectors = new Seq<>();
private ImageButton flip; private ImageButton flip;
private Table lastUnlockTable; private Table lastUnlockTable;
private Table lastUnlockLayout; private Table lastUnlockLayout;
@@ -280,20 +284,27 @@ public class HudFragment extends Fragment{
parent.fill(t -> { parent.fill(t -> {
t.top().visible(() -> state.isOutOfTime()); t.top().visible(() -> state.isOutOfTime());
t.table(Styles.black5, top -> { t.table(Styles.black5, top -> {
//TODO localize when done //TODO localize
top.add("Out of sector time.").style(Styles.outlineLabel).color(Pal.accent).update(l -> l.color.a = Mathf.absin(Time.globalTime(), 7f, 1f)).colspan(2); top.add(sectorText).style(Styles.outlineLabel).color(Pal.accent).update(l -> {
l.color.a = Mathf.absin(Time.globalTime(), 7f, 1f);
l.setText(sectorText);
}).colspan(2);
top.row(); top.row();
top.defaults().pad(2).size(150f, 54f); top.defaults().pad(2).size(150f, 54f);
top.button("Next Turn", () -> { //TODO localize
top.button("Ignore", () -> {
universe.runTurn(); universe.runTurn();
state.set(State.playing); state.set(State.playing);
}); });
top.button("Back to Planet", () -> { //TODO localize
top.button("Switch Sectors", () -> {
ui.paused.runExitSave(); ui.paused.runExitSave();
ui.planet.show();
});
control.playSector(attackedSectors.first());
}).disabled(b -> attackedSectors.isEmpty());
}).margin(8).growX(); }).margin(8).growX();
}); });
@@ -339,6 +350,7 @@ public class HudFragment extends Fragment{
}); });
//TODO DEBUG: rate table //TODO DEBUG: rate table
if(false)
parent.fill(t -> { parent.fill(t -> {
t.bottom().left(); t.bottom().left();
t.table(Styles.black6, c -> { t.table(Styles.black6, c -> {

View File

@@ -31,7 +31,7 @@ public class PlacementFragment extends Fragment{
final int rowWidth = 4; final int rowWidth = 4;
public Category currentCategory = Category.distribution; public Category currentCategory = Category.distribution;
Seq<Block> returnArray = new Seq<>(); Seq<Block> returnArray = new Seq<>(), returnArray2 = new Seq<>();
Seq<Category> returnCatArray = new Seq<>(); Seq<Category> returnCatArray = new Seq<>();
boolean[] categoryEmpty = new boolean[Category.all.length]; boolean[] categoryEmpty = new boolean[Category.all.length];
ObjectMap<Category,Block> selectedBlocks = new ObjectMap<>(); ObjectMap<Category,Block> selectedBlocks = new ObjectMap<>();
@@ -422,7 +422,7 @@ public class PlacementFragment extends Fragment{
} }
Seq<Block> getUnlockedByCategory(Category cat){ Seq<Block> getUnlockedByCategory(Category cat){
return returnArray.selectFrom(content.blocks(), block -> block.category == cat && block.isVisible() && unlocked(block)).sort((b1, b2) -> Boolean.compare(!b1.isPlaceable(), !b2.isPlaceable())); return returnArray2.selectFrom(content.blocks(), block -> block.category == cat && block.isVisible() && unlocked(block)).sort((b1, b2) -> Boolean.compare(!b1.isPlaceable(), !b2.isPlaceable()));
} }
Block getSelectedBlock(Category cat){ Block getSelectedBlock(Category cat){