diff --git a/forge-gui-mobile/src/forge/screens/match/winlose/ControlWinLose.java b/forge-gui-mobile/src/forge/screens/match/winlose/ControlWinLose.java index 6cc7a757de3..256e7edd1dd 100644 --- a/forge-gui-mobile/src/forge/screens/match/winlose/ControlWinLose.java +++ b/forge-gui-mobile/src/forge/screens/match/winlose/ControlWinLose.java @@ -1,6 +1,8 @@ package forge.screens.match.winlose; +import forge.Forge; import forge.game.GameView; +import forge.game.player.PlayerView; import forge.screens.match.MatchController; import forge.toolbox.FEvent; import forge.toolbox.FEvent.FEventHandler; @@ -14,12 +16,18 @@ import forge.toolbox.FEvent.FEventHandler; public class ControlWinLose { private final ViewWinLose view; protected final GameView lastGame; + private int humancount; /** @param v   ViewWinLose * @param match */ public ControlWinLose(final ViewWinLose v, GameView game) { view = v; lastGame = game; + humancount = 0; + for(PlayerView p: game.getPlayers()){ + if (!p.isAI()) + humancount++; + } addListeners(); } @@ -72,6 +80,8 @@ public class ControlWinLose { try { MatchController.getHostedMatch().endCurrentGame(); } catch (NullPointerException e) {} view.hide(); + if(humancount == 0) + Forge.back(); } /** diff --git a/forge-gui/src/main/java/forge/match/HostedMatch.java b/forge-gui/src/main/java/forge/match/HostedMatch.java index f939c97e874..bce3bdd6206 100644 --- a/forge-gui/src/main/java/forge/match/HostedMatch.java +++ b/forge-gui/src/main/java/forge/match/HostedMatch.java @@ -295,6 +295,7 @@ public class HostedMatch { public void endCurrentGame() { if (game == null) { return; } + boolean isMatchOver = game.getView().isMatchOver(); game = null; @@ -304,7 +305,8 @@ public class HostedMatch { humanController.getGui().clearAutoYields(); } - humanController.getGui().afterGameEnd(); + if (!GuiBase.getInterface().isLibgdxPort()||!isMatchOver) + humanController.getGui().afterGameEnd(); } humanControllers.clear(); }