Sector abandon button

This commit is contained in:
Anuken
2022-04-07 03:00:14 -04:00
parent 68a12b37c6
commit 018b2bb94b
4 changed files with 31 additions and 4 deletions

View File

@@ -480,8 +480,8 @@ public class UI implements ApplicationListener, Loadable{
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
dialog.buttons.defaults().size(200f, 54f).pad(2f);
dialog.setFillParent(false);
dialog.buttons.button("@cancel", dialog::hide);
dialog.buttons.button("@ok", () -> {
dialog.buttons.button("@cancel", Icon.cancel, dialog::hide);
dialog.buttons.button("@ok", Icon.ok, () -> {
dialog.hide();
confirmed.run();
});

View File

@@ -890,6 +890,32 @@ 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.show();
}
@@ -1080,7 +1106,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
//make sure there are no under-attack sectors (other than this one)
//TODO abandon button?
for(Planet planet : content.planets()){
if(!planet.allowWaveSimulation && !debugSelect){
int attackedCount = planet.sectors.count(s -> s.isAttacked() && s != sector);

View File

@@ -33,7 +33,7 @@ public class ItemTurret extends Turret{
/** Makes copies of all bullets and limits their range. */
public void limitRange(){
limitRange(2f);
limitRange(5f);
}
/** Makes copies of all bullets and limits their range. */