AI vs AI match shows Match Results (mobile)

This commit is contained in:
Anthony Calosa
2020-04-26 17:25:44 +08:00
parent 45a5e76e63
commit a553103e39
2 changed files with 13 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
package forge.screens.match.winlose; package forge.screens.match.winlose;
import forge.Forge;
import forge.game.GameView; import forge.game.GameView;
import forge.game.player.PlayerView;
import forge.screens.match.MatchController; import forge.screens.match.MatchController;
import forge.toolbox.FEvent; import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FEvent.FEventHandler;
@@ -14,12 +16,18 @@ import forge.toolbox.FEvent.FEventHandler;
public class ControlWinLose { public class ControlWinLose {
private final ViewWinLose view; private final ViewWinLose view;
protected final GameView lastGame; protected final GameView lastGame;
private int humancount;
/** @param v   ViewWinLose /** @param v   ViewWinLose
* @param match */ * @param match */
public ControlWinLose(final ViewWinLose v, GameView game) { public ControlWinLose(final ViewWinLose v, GameView game) {
view = v; view = v;
lastGame = game; lastGame = game;
humancount = 0;
for(PlayerView p: game.getPlayers()){
if (!p.isAI())
humancount++;
}
addListeners(); addListeners();
} }
@@ -72,6 +80,8 @@ public class ControlWinLose {
try { MatchController.getHostedMatch().endCurrentGame(); try { MatchController.getHostedMatch().endCurrentGame();
} catch (NullPointerException e) {} } catch (NullPointerException e) {}
view.hide(); view.hide();
if(humancount == 0)
Forge.back();
} }
/** /**

View File

@@ -295,6 +295,7 @@ public class HostedMatch {
public void endCurrentGame() { public void endCurrentGame() {
if (game == null) { return; } if (game == null) { return; }
boolean isMatchOver = game.getView().isMatchOver();
game = null; game = null;
@@ -304,7 +305,8 @@ public class HostedMatch {
humanController.getGui().clearAutoYields(); humanController.getGui().clearAutoYields();
} }
humanController.getGui().afterGameEnd(); if (!GuiBase.getInterface().isLibgdxPort()||!isMatchOver)
humanController.getGui().afterGameEnd();
} }
humanControllers.clear(); humanControllers.clear();
} }