diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index df4b91c089..701821940c 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -11,8 +11,8 @@ text.link.wiki.description=official Mindustry wiki text.linkfail=Failed to open link!\nThe URL has been copied to your cliboard. text.editor.web=The web version does not support the editor!\nDownload the game to use it. text.web.unsupported=The web version does not support this feature! Download the game to use it. -text.gameover=Your core has been destroyed -text.pvp.gameover=The[accent] {0}[] team is victorious! +text.gameover=Game Over +text.gameover.pvp=The[accent] {0}[] team is victorious! text.sector.gameover=This sector has been lost. Re-deploy? text.sector.retry=Retry text.highscore=[accent]New highscore! diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 62c37521be..d0a9c1bce6 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -27,6 +27,7 @@ import io.anuke.ucore.entities.Entities; import io.anuke.ucore.entities.EntityQuery; import io.anuke.ucore.modules.Module; import io.anuke.ucore.util.Atlas; +import io.anuke.mindustry.gen.Call; import static io.anuke.mindustry.Vars.*; @@ -154,7 +155,7 @@ public class Control extends Module{ threads.runGraphics(() -> { Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y); //the restart dialog can show info for any number of scenarios - ui.restart.show(event); + Call.onGameOver(event.winner); }); }); diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index 5eca69ac4d..57d3b88704 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -78,7 +78,6 @@ public class Logic extends Module{ Events.fire(new WaveEvent()); } - //this never triggers in PvP; only for checking sector game-overs private void checkGameOver(){ if(!state.mode.isPvp && state.teams.get(defaultTeam).cores.size == 0 && !state.gameOver){ state.gameOver = true; diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index 98c8c7d902..bd234e99f2 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -414,6 +414,12 @@ public class NetServer extends Module{ Log.info("&y{0} has connected.", player.name); } + @Remote(called = Loc.both) + public static void onGameOver(Team winner){ + threads.runGraphics(() -> ui.restart.show(winner)); + state.set(State.menu); + } + public boolean isWaitingForPlayers(){ return state.mode.isPvp && playerGroup.size() < 2; } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/RestartDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/RestartDialog.java index 3c76279c04..f61cc21a4d 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/RestartDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/RestartDialog.java @@ -1,14 +1,14 @@ package io.anuke.mindustry.ui.dialogs; import io.anuke.mindustry.core.GameState.State; -import io.anuke.mindustry.game.EventType.GameOverEvent; +import io.anuke.mindustry.game.Team; import io.anuke.mindustry.maps.Sector; import io.anuke.ucore.util.Bundles; import static io.anuke.mindustry.Vars.*; public class RestartDialog extends FloatingDialog{ - private GameOverEvent event; + private Team winner; public RestartDialog(){ super("$text.gameover"); @@ -16,8 +16,8 @@ public class RestartDialog extends FloatingDialog{ shown(this::rebuild); } - public void show(GameOverEvent event){ - this.event = event; + public void show(Team winner){ + this.winner = winner; show(); } @@ -28,7 +28,7 @@ public class RestartDialog extends FloatingDialog{ buttons().margin(10); if(state.mode.isPvp){ - content().add(Bundles.format("text.gameover.pvp", event.winner.localized())).pad(6); + content().add(Bundles.format("text.gameover.pvp",winner.localized())).pad(6); buttons().addButton("$text.menu", () -> { hide(); state.set(State.menu);