Misc UI tweaks + fixed tests

This commit is contained in:
Anuken
2022-10-10 21:27:11 -04:00
parent a21d908834
commit 8bd8fc5d80
6 changed files with 29 additions and 28 deletions

View File

@@ -952,33 +952,35 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
dialog.addCloseButton();
if(sector.hasBase()){
dialog.buttons.button("@sector.abandon", Icon.cancel, () -> {
ui.showConfirm("@sector.abandon.confirm", () -> {
dialog.hide();
if(sector.isBeingPlayed()){
hide();
//after dialog is hidden
Time.runTask(7f, () -> {
//force game over in a more dramatic fashion
for(var core : player.team().cores().copy()){
core.kill();
}
});
}else{
if(sector.save != null){
sector.save.delete();
}
sector.save = null;
}
updateSelected();
});
});
dialog.buttons.button("@sector.abandon", Icon.cancel, () -> abandonSectorConfirm(sector, dialog::hide));
}
dialog.show();
}
public void abandonSectorConfirm(Sector sector, Runnable listener){
ui.showConfirm("@sector.abandon.confirm", () -> {
if(listener != null) listener.run();
if(sector.isBeingPlayed()){
hide();
//after dialog is hidden
Time.runTask(7f, () -> {
//force game over in a more dramatic fashion
for(var core : player.team().cores().copy()){
core.kill();
}
});
}else{
if(sector.save != null){
sector.save.delete();
}
sector.save = null;
}
updateSelected();
});
}
void addSurvivedInfo(Sector sector, Table table, boolean wrap){
if(!wrap){
table.add(sector.planet.allowWaveSimulation ? Core.bundle.format("sectors.underattack", (int)(sector.info.damage * 100)) : "@sectors.underattack.nodamage").wrapLabel(wrap).row();