mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
AI vs AI match shows Match Results (mobile)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user