mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Fix the refactored GUI code so that games can now be played.
This commit is contained in:
@@ -92,7 +92,7 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
|
||||
return ImageIO.read(file);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
BugReporter.reportException(ex, "Could not read image file " + file.getAbsolutePath() + " ");
|
||||
BugReporter.reportException(ex, GuiBase.getInterface(), "Could not read image file " + file.getAbsolutePath() + " ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package forge;
|
||||
|
||||
import forge.control.FControl;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.properties.ForgeProfileProperties;
|
||||
import forge.view.FView;
|
||||
|
||||
@@ -48,7 +47,6 @@ public final class Singletons {
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
ForgeConstants.init(GuiBase.getInterface());
|
||||
ForgeProfileProperties.init(GuiBase.getInterface());
|
||||
|
||||
if (withUi) {
|
||||
|
||||
@@ -124,7 +124,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
EXIT_FORGE
|
||||
}
|
||||
|
||||
private final SoundSystem soundSystem = new SoundSystem(GuiBase.getInterface());
|
||||
private SoundSystem soundSystem;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -219,6 +219,8 @@ public enum FControl implements KeyEventDispatcher {
|
||||
// Preloads skin components (using progress bar).
|
||||
FSkin.loadFull(true);
|
||||
|
||||
this.soundSystem = new SoundSystem(GuiBase.getInterface());
|
||||
|
||||
this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts();
|
||||
this.display = FView.SINGLETON_INSTANCE.getLpnDocument();
|
||||
|
||||
@@ -423,7 +425,9 @@ public enum FControl implements KeyEventDispatcher {
|
||||
inputQueue.onGameOver(false); //release any waiting input, effectively passing priority
|
||||
}
|
||||
|
||||
playbackControl.onGameStopRequested();
|
||||
if (playbackControl != null) {
|
||||
playbackControl.onGameStopRequested();
|
||||
}
|
||||
}
|
||||
|
||||
private InputQueue inputQueue;
|
||||
@@ -447,7 +451,9 @@ public enum FControl implements KeyEventDispatcher {
|
||||
return; //TODO: See if it's possible to run multiple games at once without crashing
|
||||
}
|
||||
setPlayerName(match.getPlayers());
|
||||
final Game game = match.createGame();
|
||||
this.game = match.createGame();
|
||||
inputQueue = new InputQueue(game);
|
||||
|
||||
final LobbyPlayer me = getGuiPlayer();
|
||||
for (final Player p : game.getPlayers()) {
|
||||
if (p.getLobbyPlayer().equals(me)) {
|
||||
@@ -457,7 +463,6 @@ public enum FControl implements KeyEventDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
inputQueue = new InputQueue(GuiBase.getInterface(), game);
|
||||
attachToGame(this.gameView);
|
||||
|
||||
// It's important to run match in a different thread to allow GUI inputs to be invoked from inside game.
|
||||
@@ -526,7 +531,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
game0.subscribeToEvents(fcVisitor);
|
||||
|
||||
// Add playback controls to match if needed
|
||||
if (localPlayer != null) {
|
||||
if (localPlayer == null) {
|
||||
// Create dummy controller
|
||||
final PlayerControllerHuman controller =
|
||||
new PlayerControllerLocal(game, null, humanLobbyPlayer, GuiBase.getInterface());
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.toolbox.FButton;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import forge.view.CardView;
|
||||
import forge.view.FDialog;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FDeckViewer extends FDialog {
|
||||
@@ -61,7 +62,7 @@ public class FDeckViewer extends FDialog {
|
||||
return new ImageView<PaperCard>(this, model0) {
|
||||
@Override
|
||||
protected void showHoveredItem(PaperCard item) {
|
||||
final CardView card = CardView.getCardForUi(item);
|
||||
final CardView card = ViewUtil.getCardForUi(item);
|
||||
if (card == null) { return; }
|
||||
|
||||
cardDetail.setCard(card);
|
||||
@@ -77,7 +78,7 @@ public class FDeckViewer extends FDialog {
|
||||
final IPaperCard paperCard = cardManager.getSelectedItem();
|
||||
if (paperCard == null) { return; }
|
||||
|
||||
final CardView card = CardView.getCardForUi(paperCard);
|
||||
final CardView card = ViewUtil.getCardForUi(paperCard);
|
||||
if (card == null) { return; }
|
||||
|
||||
cardDetail.setCard(card);
|
||||
|
||||
@@ -37,8 +37,8 @@ import forge.properties.ForgePreferences.FPref;
|
||||
import forge.toolbox.FButton;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.view.CardView;
|
||||
import forge.view.FDialog;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* A simple class that shows a list of cards in a dialog with preview in its
|
||||
@@ -189,7 +189,7 @@ public class BoxedProductCardListViewer extends FDialog {
|
||||
// (String) jList.getSelectedValue();
|
||||
if ((row >= 0) && (row < BoxedProductCardListViewer.this.list.size())) {
|
||||
final PaperCard cp = BoxedProductCardListViewer.this.list.get(row);
|
||||
BoxedProductCardListViewer.this.detail.setCard(CardView.getCardForUi(cp));
|
||||
BoxedProductCardListViewer.this.detail.setCard(ViewUtil.getCardForUi(cp));
|
||||
BoxedProductCardListViewer.this.picture.setCard(cp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import forge.toolbox.FSkin.SkinnedPanel;
|
||||
import forge.view.CardView;
|
||||
import forge.view.CardView.CardStateView;
|
||||
import forge.view.FDialog;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* The class CardDetailPanel. Shows the details of a card.
|
||||
@@ -131,7 +132,7 @@ public class CardDetailPanel extends SkinnedPanel {
|
||||
powerToughnessLabel.setVisible(false);
|
||||
idLabel.setText("");
|
||||
cdArea.setText(CardDetailUtil.getItemDescription(item));
|
||||
this.updateBorder(item instanceof IPaperCard ? CardView.getCardForUi((IPaperCard)item).getState() : null, false);
|
||||
this.updateBorder(item instanceof IPaperCard ? ViewUtil.getCardForUi((IPaperCard)item).getState() : null, false);
|
||||
|
||||
String set = item.getEdition();
|
||||
setInfoLabel.setText(set);
|
||||
|
||||
@@ -37,8 +37,8 @@ import forge.properties.ForgePreferences.FPref;
|
||||
import forge.toolbox.FButton;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.view.CardView;
|
||||
import forge.view.FDialog;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* A simple class that shows a list of cards in a dialog with preview in its
|
||||
@@ -172,7 +172,7 @@ public class CardListViewer extends FDialog {
|
||||
// (String) jList.getSelectedValue();
|
||||
if ((row >= 0) && (row < CardListViewer.this.list.size())) {
|
||||
final PaperCard cp = CardListViewer.this.list.get(row);
|
||||
CardListViewer.this.detail.setCard(CardView.getCardForUi(cp));
|
||||
CardListViewer.this.detail.setCard(ViewUtil.getCardForUi(cp));
|
||||
CardListViewer.this.picture.setCard(cp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import forge.toolbox.FScrollPane;
|
||||
import forge.view.CardView;
|
||||
import forge.view.FDialog;
|
||||
import forge.view.SpellAbilityView;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
// An input box for handling the order of choices.
|
||||
// Left box has the original choices
|
||||
@@ -330,7 +331,7 @@ public class DualListBox<T> extends FDialog {
|
||||
} else if (obj instanceof SpellAbilityView) {
|
||||
card = ((SpellAbilityView) obj).getHostCard();
|
||||
} else if (obj instanceof PaperCard) {
|
||||
card = CardView.getCardForUi((IPaperCard) obj);
|
||||
card = ViewUtil.getCardForUi((IPaperCard) obj);
|
||||
}
|
||||
|
||||
GuiUtils.clearPanelSelections();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.gui;
|
||||
|
||||
import forge.GuiBase;
|
||||
import forge.UiCommand;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.error.BugReporter;
|
||||
@@ -513,7 +514,7 @@ public class ImportDialog {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
_progressBar.setString("Error");
|
||||
BugReporter.reportException(e);
|
||||
BugReporter.reportException(e, GuiBase.getInterface());
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
@@ -777,7 +778,7 @@ public class ImportDialog {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
// we never interrupt the thread, so this is not expected to happen
|
||||
BugReporter.reportException(e);
|
||||
BugReporter.reportException(e, GuiBase.getInterface());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -936,7 +937,7 @@ public class ImportDialog {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
_progressBar.setString("Error");
|
||||
BugReporter.reportException(e);
|
||||
BugReporter.reportException(e, GuiBase.getInterface());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import forge.toolbox.FSkin.SkinFont;
|
||||
import forge.toolbox.FSkin.SkinImage;
|
||||
import forge.toolbox.special.CardZoomer;
|
||||
import forge.view.CardView;
|
||||
import forge.view.ViewUtil;
|
||||
import forge.view.arcane.CardPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -232,7 +233,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
ItemInfo item = getItemAtPoint(e.getPoint());
|
||||
if (item != null && item.item instanceof IPaperCard) {
|
||||
setLockHoveredItem(true); //lock hoveredItem while zoomer open
|
||||
final CardView card = CardView.getCardForUi((IPaperCard) item.item);
|
||||
final CardView card = ViewUtil.getCardForUi((IPaperCard) item.item);
|
||||
CardZoomer.SINGLETON_INSTANCE.doMouseButtonZoom(card);
|
||||
}
|
||||
}
|
||||
@@ -1099,7 +1100,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
||||
if (item instanceof IPaperCard) {
|
||||
IPaperCard paperCard = (IPaperCard)item;
|
||||
if (paperCard.isFoil()) {
|
||||
final CardView card = CardView.getCardForUi(paperCard);
|
||||
final CardView card = ViewUtil.getCardForUi(paperCard);
|
||||
if (card.getFoilIndex() == 0) { //if foil finish not yet established, assign a random one
|
||||
card.setRandomFoil();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import forge.deck.DeckBase;
|
||||
import forge.deck.io.DeckHtmlSerializer;
|
||||
import forge.deck.io.DeckSerializer;
|
||||
import forge.deck.io.DeckStorage;
|
||||
import forge.error.BugReporter;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.properties.ForgeConstants;
|
||||
@@ -156,7 +155,7 @@ public enum CCurrentDeck implements ICDoc {
|
||||
}
|
||||
});
|
||||
} catch (final Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
//BugReporter.reportException(ex);
|
||||
throw new RuntimeException("Error creating new deck. " + ex);
|
||||
}
|
||||
}
|
||||
@@ -175,7 +174,7 @@ public enum CCurrentDeck implements ICDoc {
|
||||
.setModel(DeckSerializer.fromFile(file));
|
||||
|
||||
} catch (final Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
//BugReporter.reportException(ex);
|
||||
throw new RuntimeException("Error importing deck." + ex);
|
||||
}
|
||||
}
|
||||
@@ -219,7 +218,7 @@ public enum CCurrentDeck implements ICDoc {
|
||||
DeckSerializer.writeDeck(deck, filename);
|
||||
controller.setModel(DeckSerializer.fromFile(filename)); //reload deck from file so everything is in sync
|
||||
} catch (final Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
//BugReporter.reportException(ex);
|
||||
throw new RuntimeException("Error exporting deck." + ex);
|
||||
}
|
||||
}
|
||||
@@ -237,7 +236,7 @@ public enum CCurrentDeck implements ICDoc {
|
||||
((DeckController<Deck>) CDeckEditorUI.SINGLETON_INSTANCE
|
||||
.getCurrentEditorController().getDeckController()).getModel(), filename);
|
||||
} catch (final Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
//BugReporter.reportException(ex);
|
||||
throw new RuntimeException("Error exporting deck." + ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ import forge.toolbox.FTextField;
|
||||
import forge.util.Lang;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.NameGenerator;
|
||||
import forge.view.CardView;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of constructed submenu singleton.
|
||||
@@ -1228,7 +1228,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
|
||||
if (obj instanceof PaperCard) {
|
||||
pp.setVanguardButtonText(((PaperCard) obj).getName());
|
||||
cdp.setCard(CardView.getCardForUi((PaperCard) obj));
|
||||
cdp.setCard(ViewUtil.getCardForUi((PaperCard) obj));
|
||||
cdp.setVisible(true);
|
||||
refreshPanels(false, true);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import forge.toolbox.FList;
|
||||
import forge.toolbox.FPanel;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.toolbox.FSkin;
|
||||
import forge.view.CardView;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* A simple JPanel that shows three columns: card list, pic, and description..
|
||||
@@ -112,7 +112,7 @@ public class QuestWinLoseCardViewer extends FPanel {
|
||||
// (String) jList.getSelectedValue();
|
||||
if ((row >= 0) && (row < QuestWinLoseCardViewer.this.list.size())) {
|
||||
final PaperCard cp = QuestWinLoseCardViewer.this.list.get(row);
|
||||
QuestWinLoseCardViewer.this.detail.setCard(CardView.getCardForUi(cp));
|
||||
QuestWinLoseCardViewer.this.detail.setCard(ViewUtil.getCardForUi(cp));
|
||||
QuestWinLoseCardViewer.this.picture.setCard(cp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.Map;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.testng.collections.Lists;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.gui.framework.FScreen;
|
||||
@@ -245,6 +245,7 @@ public enum TargetingOverlay {
|
||||
}
|
||||
for (final CardView attackingCard : combat.getAttackers()) {
|
||||
final Iterable<CardView> cards = combat.getBlockers(attackingCard);
|
||||
if (cards == null) continue;
|
||||
for (final CardView blockingCard : cards) {
|
||||
if (!attackingCard.equals(c) && !blockingCard.equals(c)) { continue; }
|
||||
arcsCombat.add(new Point[] {
|
||||
|
||||
@@ -198,13 +198,13 @@ public class VAssignDamage {
|
||||
if (defender instanceof CardView)
|
||||
fakeCard = (CardView)defender;
|
||||
else if (defender instanceof PlayerView) {
|
||||
fakeCard = new CardView(null, -1, true);
|
||||
fakeCard = new CardView(-1, true);
|
||||
fakeCard.getState().setName(this.defender.toString());
|
||||
final PlayerView p = (PlayerView)defender;
|
||||
fakeCard.setOwner(p);
|
||||
fakeCard.getState().setImageKey(CMatchUI.SINGLETON_INSTANCE.avatarImages.get(p.getLobbyPlayer()));
|
||||
} else {
|
||||
fakeCard = new CardView(null, -2, true);
|
||||
fakeCard = new CardView(-2, true);
|
||||
fakeCard.getState().setName(this.defender.toString());
|
||||
}
|
||||
addPanelForDefender(pnlDefenders, fakeCard);
|
||||
|
||||
@@ -3,8 +3,8 @@ package forge.screens.match;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.List;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.gui.ForgeAction;
|
||||
import forge.gui.GuiChoose;
|
||||
|
||||
@@ -121,8 +121,12 @@ public enum CCombat implements ICDoc {
|
||||
}
|
||||
}
|
||||
|
||||
for (final CardView blocker : blockers) {
|
||||
display.append(" < ").append(combatantToString(blocker)).append("\n");
|
||||
if (blockers != null) {
|
||||
for (final CardView blocker : blockers) {
|
||||
display.append(" < ")
|
||||
.append(combatantToString(blocker))
|
||||
.append("\n");
|
||||
}
|
||||
}
|
||||
previousBand = isBand;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import forge.item.InventoryItemFromSet;
|
||||
import forge.screens.match.views.VDetail;
|
||||
import forge.toolbox.FMouseAdapter;
|
||||
import forge.view.CardView;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* Controls the card detail area in the match UI.
|
||||
@@ -58,7 +59,7 @@ public enum CDetail implements ICDoc {
|
||||
|
||||
public void showCard(final InventoryItem item) {
|
||||
if (item instanceof IPaperCard) {
|
||||
showCard(CardView.getCardForUi((IPaperCard)item));
|
||||
showCard(ViewUtil.getCardForUi((IPaperCard)item));
|
||||
} else if (item instanceof InventoryItemFromSet) {
|
||||
view.getLblFlipcard().setVisible(false);
|
||||
view.getPnlDetail().setItem((InventoryItemFromSet)item);
|
||||
|
||||
@@ -27,6 +27,8 @@ import java.util.Observable;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.GuiBase;
|
||||
import forge.Singletons;
|
||||
@@ -105,7 +107,11 @@ public class CHand implements ICDoc {
|
||||
}
|
||||
|
||||
//update card panels in hand area
|
||||
final List<CardView> cards = player.getHandCards();
|
||||
|
||||
final List<CardView> cards;
|
||||
synchronized (player) {
|
||||
cards = ImmutableList.copyOf(player.getHandCards());
|
||||
}
|
||||
final List<CardPanel> placeholders = new ArrayList<CardPanel>();
|
||||
final List<CardPanel> cardPanels = new ArrayList<CardPanel>();
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import forge.screens.match.views.VPicture;
|
||||
import forge.toolbox.FMouseAdapter;
|
||||
import forge.toolbox.special.CardZoomer;
|
||||
import forge.view.CardView;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* Singleton controller for VPicture.
|
||||
@@ -81,7 +82,7 @@ public enum CPicture implements ICDoc {
|
||||
public void showImage(final InventoryItem item) {
|
||||
if (item instanceof IPaperCard) {
|
||||
final IPaperCard paperCard = ((IPaperCard)item);
|
||||
final CardView c = CardView.getCardForUi(paperCard);
|
||||
final CardView c = ViewUtil.getCardForUi(paperCard);
|
||||
if (paperCard.isFoil() && c.getFoilIndex() == 0) {
|
||||
c.setRandomFoil();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class VCommand implements IVDoc<CCommand> {
|
||||
|
||||
// TODO player is hard-coded into tabletop...should be dynamic
|
||||
// (haven't looked into it too deeply). Doublestrike 12-04-12
|
||||
tabletop = new PlayArea(scroller, id0 == EDocID.COMMAND_0, player.getCommandCards());
|
||||
tabletop = new PlayArea(scroller, id0 == EDocID.COMMAND_0, player);
|
||||
|
||||
control = new CCommand(player, this);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public class VField implements IVDoc<CField> {
|
||||
|
||||
// TODO player is hard-coded into tabletop...should be dynamic
|
||||
// (haven't looked into it too deeply). Doublestrike 12-04-12
|
||||
tabletop = new PlayArea(scroller, id0 == EDocID.FIELD_1, player.getBfCards());
|
||||
tabletop = new PlayArea(scroller, id0 == EDocID.FIELD_1, player);
|
||||
|
||||
control = new CField(player, this, playerViewer);
|
||||
|
||||
|
||||
@@ -24,10 +24,9 @@ import java.util.Map.Entry;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.testng.collections.Maps;
|
||||
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
|
||||
@@ -30,7 +30,7 @@ import forge.gui.CardDetailPanel;
|
||||
import forge.gui.CardPicturePanel;
|
||||
import forge.item.PaperCard;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.view.CardView;
|
||||
import forge.view.ViewUtil;
|
||||
|
||||
/**
|
||||
* A simple JPanel that shows three columns: card list, pic, and description..
|
||||
@@ -93,7 +93,7 @@ public class CardViewer extends JPanel {
|
||||
// (String) jList.getSelectedValue();
|
||||
if ((row >= 0) && (row < CardViewer.this.list.size())) {
|
||||
final PaperCard cp = CardViewer.this.list.get(row);
|
||||
CardViewer.this.detail.setCard(CardView.getCardForUi(cp));
|
||||
CardViewer.this.detail.setCard(ViewUtil.getCardForUi(cp));
|
||||
CardViewer.this.picture.setCard(cp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class Main {
|
||||
GuiBase.setInterface(new GuiDesktop());
|
||||
|
||||
//install our error handler
|
||||
ExceptionHandler.registerErrorHandling();
|
||||
ExceptionHandler.registerErrorHandling(GuiBase.getInterface());
|
||||
|
||||
// Start splash screen first, then data models, then controller.
|
||||
if (args.length == 0) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import forge.toolbox.FScrollPane;
|
||||
import forge.toolbox.MouseTriggerEvent;
|
||||
import forge.view.CardView;
|
||||
import forge.view.CardView.CardStateView;
|
||||
import forge.view.PlayerView;
|
||||
import forge.view.arcane.util.Animation;
|
||||
import forge.view.arcane.util.CardPanelMouseListener;
|
||||
|
||||
@@ -76,7 +77,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
private int extraCardSpacingX, cardSpacingX, cardSpacingY;
|
||||
private int stackSpacingX, stackSpacingY;
|
||||
|
||||
private final List<CardView> model;
|
||||
private final PlayerView model;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -85,13 +86,13 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
*
|
||||
* @param scrollPane
|
||||
* @param mirror
|
||||
* @param list
|
||||
* @param player
|
||||
*/
|
||||
public PlayArea(final FScrollPane scrollPane, final boolean mirror, final List<CardView> list) {
|
||||
public PlayArea(final FScrollPane scrollPane, final boolean mirror, final PlayerView player) {
|
||||
super(scrollPane);
|
||||
this.setBackground(Color.white);
|
||||
this.mirror = mirror;
|
||||
this.model = list;
|
||||
this.model = player;
|
||||
}
|
||||
|
||||
private final CardStackRow collectAllLands() {
|
||||
@@ -577,7 +578,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
}
|
||||
super.mouseLeftClicked(panel, evt);
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void mouseRightClicked(final CardPanel panel, final MouseEvent evt) {
|
||||
@@ -595,7 +596,12 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
recalculateCardPanels(model);
|
||||
}
|
||||
|
||||
private void recalculateCardPanels(final List<CardView> model) {
|
||||
private void recalculateCardPanels(final PlayerView model) {
|
||||
final List<CardView> modelCopy;
|
||||
synchronized (model) {
|
||||
modelCopy = Lists.newArrayList(model.getBfCards());
|
||||
}
|
||||
|
||||
final List<CardView> oldCards = Lists.newArrayList();
|
||||
for (final CardPanel cpa : getCardPanels()) {
|
||||
oldCards.add(cpa.getCard());
|
||||
@@ -604,7 +610,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
final List<CardView> toReplace = Lists.newArrayList();
|
||||
|
||||
// delete all cards that differ in timestamp (they have been blinked)
|
||||
for (final CardView c : model) {
|
||||
for (final CardView c : modelCopy) {
|
||||
for (int i = 0; i < toDelete.size(); i++) {
|
||||
final CardView c2 = toDelete.get(i);
|
||||
if (c.getId() == c2.getId()) {
|
||||
@@ -623,8 +629,8 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
removeCardPanel(getCardPanel(card.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
final List<CardView> toAdd = new ArrayList<CardView>(model);
|
||||
|
||||
final List<CardView> toAdd = new ArrayList<CardView>(modelCopy);
|
||||
toAdd.removeAll(oldCards);
|
||||
toAdd.addAll(toReplace);
|
||||
|
||||
@@ -648,7 +654,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
}
|
||||
}
|
||||
|
||||
for (final CardView card : model) {
|
||||
for (final CardView card : modelCopy) {
|
||||
updateCard(card, true);
|
||||
}
|
||||
invalidate();
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PanelTest extends JFrame {
|
||||
this.jbInit();
|
||||
}
|
||||
catch (final Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user