mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-04-27 07:50:54 -07:00
Fixed #2553
This commit is contained in:
parent
8901838c19
commit
d6447cb31a
4 changed files with 35 additions and 10 deletions
Binary file not shown.
|
|
@ -55,9 +55,22 @@ public class Universe{
|
|||
|
||||
public void displayTimeEnd(){
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ public class HudFragment extends Fragment{
|
|||
|
||||
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 Table lastUnlockTable;
|
||||
private Table lastUnlockLayout;
|
||||
|
|
@ -280,20 +284,27 @@ public class HudFragment extends Fragment{
|
|||
parent.fill(t -> {
|
||||
t.top().visible(() -> state.isOutOfTime());
|
||||
t.table(Styles.black5, top -> {
|
||||
//TODO localize when done
|
||||
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);
|
||||
//TODO localize
|
||||
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.defaults().pad(2).size(150f, 54f);
|
||||
top.button("Next Turn", () -> {
|
||||
//TODO localize
|
||||
top.button("Ignore", () -> {
|
||||
universe.runTurn();
|
||||
state.set(State.playing);
|
||||
});
|
||||
|
||||
top.button("Back to Planet", () -> {
|
||||
//TODO localize
|
||||
top.button("Switch Sectors", () -> {
|
||||
ui.paused.runExitSave();
|
||||
ui.planet.show();
|
||||
});
|
||||
|
||||
|
||||
control.playSector(attackedSectors.first());
|
||||
}).disabled(b -> attackedSectors.isEmpty());
|
||||
}).margin(8).growX();
|
||||
});
|
||||
|
||||
|
|
@ -339,6 +350,7 @@ public class HudFragment extends Fragment{
|
|||
});
|
||||
|
||||
//TODO DEBUG: rate table
|
||||
if(false)
|
||||
parent.fill(t -> {
|
||||
t.bottom().left();
|
||||
t.table(Styles.black6, c -> {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class PlacementFragment extends Fragment{
|
|||
final int rowWidth = 4;
|
||||
|
||||
public Category currentCategory = Category.distribution;
|
||||
Seq<Block> returnArray = new Seq<>();
|
||||
Seq<Block> returnArray = new Seq<>(), returnArray2 = new Seq<>();
|
||||
Seq<Category> returnCatArray = new Seq<>();
|
||||
boolean[] categoryEmpty = new boolean[Category.all.length];
|
||||
ObjectMap<Category,Block> selectedBlocks = new ObjectMap<>();
|
||||
|
|
@ -422,7 +422,7 @@ public class PlacementFragment extends Fragment{
|
|||
}
|
||||
|
||||
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){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue