* Changed graveyard window handling to a window that can stay open.

This commit is contained in:
LevelX2 2015-06-23 00:46:27 +02:00
parent 259ef3aed5
commit 67e9ee1fa9
7 changed files with 120 additions and 81 deletions

View file

@ -148,6 +148,8 @@ public final class GamePanel extends javax.swing.JPanel {
private final Map<UUID, CardInfoWindowDialog> exiles = new HashMap<>();
private final Map<String, CardInfoWindowDialog> revealed = new HashMap<>();
private final Map<String, CardInfoWindowDialog> lookedAt = new HashMap<>();
private final Map<String, CardInfoWindowDialog> graveyardWindows = new HashMap<>();
private final Map<String, CardsView> graveyards = new HashMap<>();
private final ArrayList<ShowCardsDialog> pickTarget = new ArrayList<>();
private UUID gameId;
private UUID playerId; // playerId of the player
@ -261,6 +263,10 @@ public final class GamePanel extends javax.swing.JPanel {
exileDialog.cleanUp();
exileDialog.removeDialog();
}
for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) {
graveyardDialog.cleanUp();
graveyardDialog.removeDialog();
}
for (CardInfoWindowDialog revealDialog: revealed.values()) {
revealDialog.cleanUp();
revealDialog.removeDialog();
@ -650,6 +656,17 @@ public final class GamePanel extends javax.swing.JPanel {
if (player.getPlayerId().equals(playerId)) {
updateSkipButtons(player.isPassedTurn(), player.isPassedUntilEndOfTurn(), player.isPassedUntilNextMain(), player.isPassedAllTurns(), player.isPassedUntilStackResolved());
}
// update open or remove closed graveyard windows
graveyards.put(player.getName(), player.getGraveyard());
if (graveyardWindows.containsKey(player.getName())) {
CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(player.getName());
if (cardInfoWindowDialog.isClosed()) {
graveyardWindows.remove(player.getName());
} else {
cardInfoWindowDialog.loadCards(player.getGraveyard(), bigCard, gameId);
}
}
} else {
logger.warn("Couldn't find player.");
logger.warn(" uuid:" + player.getPlayerId());
@ -691,6 +708,7 @@ public final class GamePanel extends javax.swing.JPanel {
}
exiles.get(exile.getId()).loadCards(exile, bigCard, gameId);
}
showRevealed(game);
showLookedAt(game);
if (game.getCombat().size() > 0) {
@ -808,6 +826,24 @@ public final class GamePanel extends javax.swing.JPanel {
}
}
public void openGraveyardWindow(String playerName) {
if(graveyardWindows.containsKey(playerName)) {
CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(playerName);
if (cardInfoWindowDialog.isVisible()) {
cardInfoWindowDialog.hideDialog();
} else {
cardInfoWindowDialog.show();
}
// if (!cardInfoWindowDialog.isClosed()) {
return;
// }
}
CardInfoWindowDialog newGraveyard = new CardInfoWindowDialog(ShowType.GRAVEYARD, playerName);
graveyardWindows.put(playerName, newGraveyard);
MageFrame.getDesktop().add(newGraveyard, JLayeredPane.MODAL_LAYER);
newGraveyard.loadCards(graveyards.get(playerName), bigCard, gameId);
}
private void showRevealed(GameView game) {
for (RevealedView revealView: game.getRevealed()) {
handleGameInfoWindow(revealed, ShowType.REVEAL, revealView.getName(), revealView.getCards());