mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Fix showing all hands for hotseat and AI vs AI.
This commit is contained in:
@@ -474,8 +474,10 @@ public enum FControl implements KeyEventDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
boolean openAllHands = !anyPlayerIsAi;
|
||||
if (this.gameView == null) {
|
||||
// Watch game but do not participate
|
||||
openAllHands = true;
|
||||
final LocalGameView gameView = new WatchLocalGame(game, inputQueue);
|
||||
this.gameView = gameView;
|
||||
this.fcVisitor = new FControlGameEventHandler(GuiBase.getInterface(), gameView);
|
||||
@@ -484,7 +486,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
this.game.subscribeToEvents(playbackControl);
|
||||
}
|
||||
|
||||
attachToGame(this.gameView);
|
||||
attachToGame(this.gameView, openAllHands);
|
||||
|
||||
// It's important to run match in a different thread to allow GUI inputs to be invoked from inside game.
|
||||
// Game is set on pause while gui player takes decisions
|
||||
@@ -507,7 +509,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
|
||||
private FControlGameEventHandler fcVisitor;
|
||||
private FControlGamePlayback playbackControl;
|
||||
private void attachToGame(final IGameView game0) {
|
||||
private void attachToGame(final IGameView game0, final boolean openAllHands) {
|
||||
if (game0.getGameType().equals(GameType.Quest)) {
|
||||
QuestController qc = FModel.getQuest();
|
||||
// Reset new list when the Match round starts, not when each game starts
|
||||
@@ -525,7 +527,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
final LobbyPlayer humanLobbyPlayer = getGuiPlayer();
|
||||
// The UI controls should use these game data as models
|
||||
final List<PlayerView> players = game0.getPlayers();
|
||||
CMatchUI.SINGLETON_INSTANCE.initMatch(game0, players, humanLobbyPlayer);
|
||||
CMatchUI.SINGLETON_INSTANCE.initMatch(game0, players, humanLobbyPlayer, openAllHands);
|
||||
|
||||
localPlayer = null;
|
||||
for (final PlayerView p : players) {
|
||||
|
||||
@@ -92,6 +92,7 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
||||
private IGameView game;
|
||||
private List<PlayerView> sortedPlayers;
|
||||
private VMatchUI view;
|
||||
private boolean allHands;
|
||||
|
||||
private EventBus uiEvents;
|
||||
private IVDoc<? extends ICDoc> selectedDocBeforeCombat;
|
||||
@@ -119,14 +120,11 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates at a match with a specified number of players
|
||||
* and hands.
|
||||
*
|
||||
* @param numFieldPanels int
|
||||
* @param numHandPanels int
|
||||
* Instantiates at a match.
|
||||
*/
|
||||
public void initMatch(final IGameView game, final List<PlayerView> players, LobbyPlayer localPlayer) {
|
||||
public void initMatch(final IGameView game, final List<PlayerView> players, final LobbyPlayer localPlayer, final boolean allHands) {
|
||||
this.game = game;
|
||||
this.allHands = allHands;
|
||||
view = VMatchUI.SINGLETON_INSTANCE;
|
||||
// TODO fix for use with multiplayer
|
||||
|
||||
@@ -160,15 +158,18 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
||||
|
||||
VPlayers.SINGLETON_INSTANCE.init(players);
|
||||
|
||||
initHandViews(localPlayer);
|
||||
initHandViews(localPlayer, allHands);
|
||||
}
|
||||
|
||||
public void initHandViews(LobbyPlayer localPlayer) {
|
||||
public void initHandViews(final LobbyPlayer localPlayer) {
|
||||
this.initHandViews(localPlayer, this.allHands);
|
||||
}
|
||||
public void initHandViews(final LobbyPlayer localPlayer, final boolean allHands) {
|
||||
final List<VHand> hands = new ArrayList<VHand>();
|
||||
|
||||
int i = 0;
|
||||
for (final PlayerView p : sortedPlayers) {
|
||||
if (p.getLobbyPlayer().equals(localPlayer) || !p.getHandCards().isEmpty()) {
|
||||
if (allHands || p.getLobbyPlayer().equals(localPlayer) || !p.getHandCards().isEmpty()) {
|
||||
VHand newHand = new VHand(EDocID.Hands[i], p);
|
||||
newHand.getLayoutControl().initialize();
|
||||
hands.add(newHand);
|
||||
|
||||
@@ -10,7 +10,6 @@ import forge.view.IGameView;
|
||||
public abstract class LimitedWinLoseController {
|
||||
private final IWinLoseView<? extends IButton> view;
|
||||
private final IGameView lastGame;
|
||||
private final IGuiBase gui;
|
||||
private final boolean wonMatch;
|
||||
private GauntletMini gauntlet;
|
||||
private boolean nextRound = false;
|
||||
@@ -18,7 +17,6 @@ public abstract class LimitedWinLoseController {
|
||||
public LimitedWinLoseController(IWinLoseView<? extends IButton> view0, final IGameView game0, final IGuiBase gui) {
|
||||
view = view0;
|
||||
lastGame = game0;
|
||||
this.gui = gui;
|
||||
gauntlet = FModel.getGauntletMini(gui);
|
||||
wonMatch = lastGame.isMatchWonBy(GamePlayerUtil.getGuiPlayer());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user