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;
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user