mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
modifed revealed cards
This commit is contained in:
parent
55feb4a320
commit
360bbc86b5
20 changed files with 237 additions and 25 deletions
|
|
@ -58,6 +58,8 @@ import mage.view.CardsView;
|
|||
*/
|
||||
public class ShowCardsDialog extends MageDialog implements MouseListener {
|
||||
|
||||
private boolean reloaded = false;
|
||||
|
||||
/** Creates new form ShowCardsDialog */
|
||||
public ShowCardsDialog() {
|
||||
initComponents();
|
||||
|
|
@ -65,6 +67,7 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
|||
}
|
||||
|
||||
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal) {
|
||||
this.reloaded = true;
|
||||
this.title = name;
|
||||
cardArea.removeAll();
|
||||
if (showCards != null && showCards.size() < 10)
|
||||
|
|
@ -129,6 +132,14 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
|||
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth * columns, Config.dimensions.frameHeight + 400));
|
||||
}
|
||||
|
||||
public boolean isReloaded() {
|
||||
return this.reloaded;
|
||||
}
|
||||
|
||||
public void clearReloaded() {
|
||||
this.reloaded = false;
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ import java.awt.*;
|
|||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
|
@ -51,6 +53,7 @@ import javax.swing.border.LineBorder;
|
|||
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.Cards;
|
||||
import mage.client.deckeditor.collection.viewer.MageBook;
|
||||
import mage.client.dialog.ExileZoneDialog;
|
||||
import mage.client.dialog.PickChoiceDialog;
|
||||
import mage.client.dialog.ShowCardsDialog;
|
||||
|
|
@ -60,12 +63,14 @@ import mage.client.remote.Session;
|
|||
import mage.client.util.Config;
|
||||
import mage.client.util.GameManager;
|
||||
import mage.client.util.PhaseManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.util.Logging;
|
||||
import mage.view.AbilityPickerView;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.ExileView;
|
||||
import mage.view.GameView;
|
||||
import mage.view.PlayerView;
|
||||
import mage.view.RevealedView;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -77,6 +82,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
private Map<UUID, PlayAreaPanel> players = new HashMap<UUID, PlayAreaPanel>();
|
||||
private Map<UUID, ExileZoneDialog> exiles = new HashMap<UUID, ExileZoneDialog>();
|
||||
private Map<String, ShowCardsDialog> revealed = new HashMap<String, ShowCardsDialog>();
|
||||
private UUID gameId;
|
||||
private UUID playerId;
|
||||
private Session session;
|
||||
|
|
@ -136,6 +142,9 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
for (ExileZoneDialog exile: exiles.values()) {
|
||||
exile.hide();
|
||||
}
|
||||
for (ShowCardsDialog reveal: revealed.values()) {
|
||||
reveal.hide();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void showGame(UUID gameId, UUID playerId) {
|
||||
|
|
@ -321,6 +330,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
exiles.get(exile.getId()).loadCards(exile, bigCard, gameId);
|
||||
}
|
||||
showRevealed(game);
|
||||
if (game.getCombat().size() > 0) {
|
||||
MageFrame.getCombatDialog().showDialog(game.getCombat());
|
||||
}
|
||||
|
|
@ -331,6 +341,19 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
this.repaint();
|
||||
}
|
||||
|
||||
private void showRevealed(GameView game) {
|
||||
for (ShowCardsDialog reveal: revealed.values()) {
|
||||
reveal.clearReloaded();
|
||||
}
|
||||
for (RevealedView reveal: game.getRevealed()) {
|
||||
if (!revealed.containsKey(reveal.getName())) {
|
||||
ShowCardsDialog newReveal = new ShowCardsDialog();
|
||||
revealed.put(reveal.getName(), newReveal);
|
||||
}
|
||||
revealed.get(reveal.getName()).loadCards("Revealed " + reveal.getName(), reveal.getCards(), bigCard, Config.dimensions, gameId, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void ask(String question, GameView gameView) {
|
||||
updateGame(gameView);
|
||||
this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, true, false);
|
||||
|
|
@ -387,11 +410,11 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
this.abilityPicker.show(choices, MageFrame.getDesktop().getMousePosition());
|
||||
}
|
||||
|
||||
public void revealCards(String name, CardsView cards) {
|
||||
ShowCardsDialog showCards = new ShowCardsDialog();
|
||||
showCards.loadCards(name, cards, bigCard, Config.dimensions, gameId, false);
|
||||
}
|
||||
|
||||
// public void revealCards(String name, CardsView cards) {
|
||||
// ShowCardsDialog showCards = new ShowCardsDialog();
|
||||
// showCards.loadCards(name, cards, bigCard, Config.dimensions, gameId, false);
|
||||
// }
|
||||
//
|
||||
private void showCards(String title, CardsView cards, boolean required) {
|
||||
ShowCardsDialog showCards = new ShowCardsDialog();
|
||||
showCards.loadCards(title, cards, bigCard, Config.dimensions, gameId, required);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue