This commit is contained in:
Anuken
2025-08-17 10:22:22 -04:00
parent 76da302458
commit 1fe5055a96
5 changed files with 14 additions and 2 deletions

View File

@@ -675,10 +675,14 @@ public class Control implements ApplicationListener, Loadable{
state.set(State.playing);
}
if(!net.client() && Core.input.keyTap(Binding.pause) && !renderer.isCutscene() && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){
if(!net.client() && Core.input.keyTap(Binding.pause) && !(state.isCampaign() && state.afterGameOver) && !renderer.isCutscene() && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){
state.set(state.isPaused() ? State.playing : State.paused);
}
if(state.isCampaign() && state.afterGameOver){
state.set(State.paused);
}
if(Core.input.keyTap(Binding.menu) && !ui.restart.isShown() && !ui.minimapfrag.shown()){
if(ui.chatfrag.shown()){
ui.chatfrag.hide();

View File

@@ -22,6 +22,8 @@ public class GameState{
public long updateId;
/** Whether the game is in game over state. */
public boolean gameOver = false;
/** For the campaign, this is whether the map is in a "after game over" state. In this state, the game is always paused. */
public boolean afterGameOver = false;
/** Whether the player's team won the match. */
public boolean won = false;
/** Server ticks/second. Only valid in multiplayer. */

View File

@@ -39,6 +39,7 @@ public class GameOverDialog extends BaseDialog{
public void show(Team winner){
this.winner = winner;
state.afterGameOver = true;
show();
if(winner == player.team()){
Events.fire(new WinEvent());

View File

@@ -57,7 +57,7 @@ public class PausedDialog extends BaseDialog{
.visible(() -> state.rules.sector != null && state.rules.sector.preset != null && state.rules.sector.preset.description != null).padTop(-60f);
cont.button("@abandon", Icon.cancel, () -> ui.planet.abandonSectorConfirm(state.rules.sector, this::hide)).padTop(-60f)
.disabled(b -> net.client()).visible(() -> state.rules.sector != null).row();
.disabled(b -> net.client() || state.gameOver).visible(() -> state.rules.sector != null).row();
cont.button("@back", Icon.left, this::hide).name("back");
cont.button("@settings", Icon.settings, ui.settings::show).name("settings");

View File

@@ -918,6 +918,11 @@ public class HudFragment{
return builder;
}
//do not show status after game over
if(state.afterGameOver && state.isCampaign()){
return builder;
}
if(!state.rules.waves && state.isCampaign()){
builder.append("[lightgray]").append(Core.bundle.get("sector.curcapture"));
}