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) {
|
if (this.gameView == null) {
|
||||||
// Watch game but do not participate
|
// Watch game but do not participate
|
||||||
|
openAllHands = true;
|
||||||
final LocalGameView gameView = new WatchLocalGame(game, inputQueue);
|
final LocalGameView gameView = new WatchLocalGame(game, inputQueue);
|
||||||
this.gameView = gameView;
|
this.gameView = gameView;
|
||||||
this.fcVisitor = new FControlGameEventHandler(GuiBase.getInterface(), gameView);
|
this.fcVisitor = new FControlGameEventHandler(GuiBase.getInterface(), gameView);
|
||||||
@@ -484,7 +486,7 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
this.game.subscribeToEvents(playbackControl);
|
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.
|
// 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
|
// Game is set on pause while gui player takes decisions
|
||||||
@@ -507,7 +509,7 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
|
|
||||||
private FControlGameEventHandler fcVisitor;
|
private FControlGameEventHandler fcVisitor;
|
||||||
private FControlGamePlayback playbackControl;
|
private FControlGamePlayback playbackControl;
|
||||||
private void attachToGame(final IGameView game0) {
|
private void attachToGame(final IGameView game0, final boolean openAllHands) {
|
||||||
if (game0.getGameType().equals(GameType.Quest)) {
|
if (game0.getGameType().equals(GameType.Quest)) {
|
||||||
QuestController qc = FModel.getQuest();
|
QuestController qc = FModel.getQuest();
|
||||||
// Reset new list when the Match round starts, not when each game starts
|
// 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();
|
final LobbyPlayer humanLobbyPlayer = getGuiPlayer();
|
||||||
// The UI controls should use these game data as models
|
// The UI controls should use these game data as models
|
||||||
final List<PlayerView> players = game0.getPlayers();
|
final List<PlayerView> players = game0.getPlayers();
|
||||||
CMatchUI.SINGLETON_INSTANCE.initMatch(game0, players, humanLobbyPlayer);
|
CMatchUI.SINGLETON_INSTANCE.initMatch(game0, players, humanLobbyPlayer, openAllHands);
|
||||||
|
|
||||||
localPlayer = null;
|
localPlayer = null;
|
||||||
for (final PlayerView p : players) {
|
for (final PlayerView p : players) {
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
|||||||
private IGameView game;
|
private IGameView game;
|
||||||
private List<PlayerView> sortedPlayers;
|
private List<PlayerView> sortedPlayers;
|
||||||
private VMatchUI view;
|
private VMatchUI view;
|
||||||
|
private boolean allHands;
|
||||||
|
|
||||||
private EventBus uiEvents;
|
private EventBus uiEvents;
|
||||||
private IVDoc<? extends ICDoc> selectedDocBeforeCombat;
|
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
|
* Instantiates at a match.
|
||||||
* and hands.
|
|
||||||
*
|
|
||||||
* @param numFieldPanels int
|
|
||||||
* @param numHandPanels int
|
|
||||||
*/
|
*/
|
||||||
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.game = game;
|
||||||
|
this.allHands = allHands;
|
||||||
view = VMatchUI.SINGLETON_INSTANCE;
|
view = VMatchUI.SINGLETON_INSTANCE;
|
||||||
// TODO fix for use with multiplayer
|
// TODO fix for use with multiplayer
|
||||||
|
|
||||||
@@ -160,15 +158,18 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
|||||||
|
|
||||||
VPlayers.SINGLETON_INSTANCE.init(players);
|
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>();
|
final List<VHand> hands = new ArrayList<VHand>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (final PlayerView p : sortedPlayers) {
|
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);
|
VHand newHand = new VHand(EDocID.Hands[i], p);
|
||||||
newHand.getLayoutControl().initialize();
|
newHand.getLayoutControl().initialize();
|
||||||
hands.add(newHand);
|
hands.add(newHand);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import forge.view.IGameView;
|
|||||||
public abstract class LimitedWinLoseController {
|
public abstract class LimitedWinLoseController {
|
||||||
private final IWinLoseView<? extends IButton> view;
|
private final IWinLoseView<? extends IButton> view;
|
||||||
private final IGameView lastGame;
|
private final IGameView lastGame;
|
||||||
private final IGuiBase gui;
|
|
||||||
private final boolean wonMatch;
|
private final boolean wonMatch;
|
||||||
private GauntletMini gauntlet;
|
private GauntletMini gauntlet;
|
||||||
private boolean nextRound = false;
|
private boolean nextRound = false;
|
||||||
@@ -18,7 +17,6 @@ public abstract class LimitedWinLoseController {
|
|||||||
public LimitedWinLoseController(IWinLoseView<? extends IButton> view0, final IGameView game0, final IGuiBase gui) {
|
public LimitedWinLoseController(IWinLoseView<? extends IButton> view0, final IGameView game0, final IGuiBase gui) {
|
||||||
view = view0;
|
view = view0;
|
||||||
lastGame = game0;
|
lastGame = game0;
|
||||||
this.gui = gui;
|
|
||||||
gauntlet = FModel.getGauntletMini(gui);
|
gauntlet = FModel.getGauntletMini(gui);
|
||||||
wonMatch = lastGame.isMatchWonBy(GamePlayerUtil.getGuiPlayer());
|
wonMatch = lastGame.isMatchWonBy(GamePlayerUtil.getGuiPlayer());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user