mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Quest UI is now fully updated. Deprecated classes and packages removed from codebase.
This commit is contained in:
16
.gitattributes
vendored
16
.gitattributes
vendored
@@ -11192,19 +11192,6 @@ src/main/java/forge/quest/data/pet/QuestPetManager.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/data/pet/QuestPetPlant.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/data/pet/QuestPetWolf.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/data/pet/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/QuestAbstractPanel.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/QuestFrame.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/QuestMainPanel.java -text
|
||||
src/main/java/forge/quest/gui/QuestOptions.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/QuestWinLoseCardViewer.java -text
|
||||
src/main/java/forge/quest/gui/QuestWinLoseHandler.java -text
|
||||
src/main/java/forge/quest/gui/bazaar/QuestBazaarPanel.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/bazaar/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/main/QuestChallengePanel.java -text
|
||||
src/main/java/forge/quest/gui/main/QuestDuelPanel.java -text
|
||||
src/main/java/forge/quest/gui/main/QuestSelectablePanel.java -text
|
||||
src/main/java/forge/quest/gui/main/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/util/Base64Coder.java svneol=native#text/plain
|
||||
src/main/java/forge/util/CopyFiles.java svneol=native#text/plain
|
||||
@@ -11235,6 +11222,8 @@ src/main/java/forge/view/home/ViewSettings.java -text
|
||||
src/main/java/forge/view/home/ViewUtilities.java -text
|
||||
src/main/java/forge/view/home/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/view/match/MatchTopLevel.java -text
|
||||
src/main/java/forge/view/match/QuestWinLoseCardViewer.java -text
|
||||
src/main/java/forge/view/match/QuestWinLoseHandler.java -text
|
||||
src/main/java/forge/view/match/ViewBattlefield.java -text
|
||||
src/main/java/forge/view/match/ViewDetail.java -text
|
||||
src/main/java/forge/view/match/ViewDock.java -text
|
||||
@@ -11309,7 +11298,6 @@ src/test/java/forge/GuiDownloadSetPicturesLQTest.java svneol=native#text/plain
|
||||
src/test/java/forge/GuiMigrateLocalMWSSetPicturesHQTest.java svneol=native#text/plain
|
||||
src/test/java/forge/GuiMultipleBlockers4Test.java svneol=native#text/plain
|
||||
src/test/java/forge/GuiProgressBarWindowTest.java svneol=native#text/plain
|
||||
src/test/java/forge/GuiQuestOptionsTest.java svneol=native#text/plain
|
||||
src/test/java/forge/PanelTest.java svneol=native#text/plain
|
||||
src/test/java/forge/PhaseHandlerTest.java -text
|
||||
src/test/java/forge/RunTest.java svneol=native#text/plain
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.SetUtils;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants.Quest;
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Abstract QuestAbstractPanel class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class QuestAbstractPanel extends JPanel {
|
||||
/** Constant <code>serialVersionUID=-6378675010346615367L</code>. */
|
||||
private static final long serialVersionUID = -6378675010346615367L;
|
||||
|
||||
/** The main frame. */
|
||||
private QuestFrame mainFrame;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for QuestAbstractPanel.
|
||||
* </p>
|
||||
*
|
||||
* @param mainFrame
|
||||
* a {@link forge.quest.gui.QuestFrame} object.
|
||||
*/
|
||||
protected QuestAbstractPanel(final QuestFrame mainFrame) {
|
||||
this.setMainFrame(mainFrame);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* refreshState.
|
||||
* </p>
|
||||
*/
|
||||
public abstract void refreshState();
|
||||
|
||||
/**
|
||||
* Gets the main frame.
|
||||
*
|
||||
* @return the mainFrame
|
||||
*/
|
||||
public QuestFrame getMainFrame() {
|
||||
return this.mainFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the main frame.
|
||||
*
|
||||
* @param mainFrame0
|
||||
* the mainFrame to set
|
||||
*/
|
||||
public void setMainFrame(final QuestFrame mainFrame0) {
|
||||
this.mainFrame = mainFrame0;
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.gui.GuiUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestFrame class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestFrame extends JFrame {
|
||||
/** Constant <code>serialVersionUID=-2832625381531838412L</code>. */
|
||||
private static final long serialVersionUID = -2832625381531838412L;
|
||||
|
||||
/** The visible panel. */
|
||||
private final JPanel visiblePanel;
|
||||
|
||||
/** The quest layout. */
|
||||
private final CardLayout questLayout;
|
||||
|
||||
/** Constant <code>MAIN_PANEL="Main"</code>. */
|
||||
public static final String MAIN_PANEL = "Main";
|
||||
|
||||
/** Constant <code>BAZAAR_PANEL="Bazaar"</code>. */
|
||||
public static final String BAZAAR_PANEL = "Bazaar";
|
||||
|
||||
/** The sub panel map. */
|
||||
private final Map<String, QuestAbstractPanel> subPanelMap = new HashMap<String, QuestAbstractPanel>();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for QuestFrame.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* the headless exception
|
||||
*/
|
||||
public QuestFrame() {
|
||||
this.setTitle("Quest Mode");
|
||||
|
||||
this.visiblePanel = new JPanel(new BorderLayout());
|
||||
this.visiblePanel.setBorder(new EmptyBorder(2, 2, 2, 2));
|
||||
this.questLayout = new CardLayout();
|
||||
this.visiblePanel.setLayout(this.questLayout);
|
||||
|
||||
QuestAbstractPanel newPanel = new QuestMainPanel(this);
|
||||
this.visiblePanel.add(newPanel, QuestFrame.MAIN_PANEL);
|
||||
this.subPanelMap.put(QuestFrame.MAIN_PANEL, newPanel);
|
||||
|
||||
newPanel = null; //new QuestBazaarPanel(this);
|
||||
this.visiblePanel.add(newPanel, QuestFrame.BAZAAR_PANEL);
|
||||
this.subPanelMap.put(QuestFrame.BAZAAR_PANEL, newPanel);
|
||||
|
||||
this.getContentPane().setLayout(new BorderLayout());
|
||||
this.getContentPane().add(this.visiblePanel, BorderLayout.CENTER);
|
||||
this.setPreferredSize(new Dimension(1024, 768));
|
||||
this.setMinimumSize(new Dimension(800, 600));
|
||||
|
||||
this.questLayout.show(this.visiblePanel, QuestFrame.MAIN_PANEL);
|
||||
|
||||
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
this.pack();
|
||||
this.setVisible(true);
|
||||
|
||||
GuiUtils.centerFrame(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showPane.
|
||||
* </p>
|
||||
*
|
||||
* @param paneName
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
private void showPane(final String paneName) {
|
||||
this.subPanelMap.get(paneName).refreshState();
|
||||
this.questLayout.show(this.visiblePanel, paneName);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showMainPane.
|
||||
* </p>
|
||||
*/
|
||||
public final void showMainPane() {
|
||||
this.showPane(QuestFrame.MAIN_PANEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showBazaarPane.
|
||||
* </p>
|
||||
*/
|
||||
public final void showBazaarPane() {
|
||||
this.showPane(QuestFrame.BAZAAR_PANEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* returnToMainMenu.
|
||||
* </p>
|
||||
*/
|
||||
public final void returnToMainMenu() {
|
||||
AllZone.getQuestData().saveData();
|
||||
//new OldGuiNewGame();
|
||||
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,945 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.EtchedBorder;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.ImageCache;
|
||||
import forge.control.FControl;
|
||||
import forge.deck.Deck;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.deckeditor.DeckEditorQuest;
|
||||
import forge.gui.deckeditor.DeckEditorShop;
|
||||
import forge.quest.data.QuestChallenge;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.quest.data.QuestDuel;
|
||||
import forge.quest.data.QuestEventManager;
|
||||
import forge.quest.data.QuestUtil;
|
||||
import forge.quest.data.item.QuestItemZeppelin;
|
||||
import forge.quest.gui.main.QuestChallengePanel;
|
||||
import forge.quest.gui.main.QuestDuelPanel;
|
||||
import forge.quest.gui.main.QuestSelectablePanel;
|
||||
import forge.view.GuiTopLevel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestMainPanel class.
|
||||
* </p>
|
||||
* VIEW - lays out swing components for duel and challenge events.
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: QuestMainPanel.java 10358 2011-09-11 05:20:13Z Doublestrike $
|
||||
*/
|
||||
public class QuestMainPanel extends QuestAbstractPanel {
|
||||
/** Constant <code>serialVersionUID=6142934729724012402L</code>. */
|
||||
private static final long serialVersionUID = 6142934729724012402L;
|
||||
|
||||
private final forge.quest.data.QuestData questData;
|
||||
private forge.quest.data.QuestEventManager qem;
|
||||
|
||||
/** The credits label. */
|
||||
private final JLabel creditsLabel = new JLabel();
|
||||
|
||||
/** The life label. */
|
||||
private final JLabel lifeLabel = new JLabel();
|
||||
|
||||
/** The stats label. */
|
||||
private final JLabel statsLabel = new JLabel();
|
||||
|
||||
/** The title label. */
|
||||
private final JLabel titleLabel = new JLabel();
|
||||
|
||||
/** The next quest label. */
|
||||
private final JLabel nextQuestLabel = new JLabel();
|
||||
|
||||
/** The pet combo box. */
|
||||
private final JComboBox petComboBox = new JComboBox();
|
||||
|
||||
/** The deck combo box. */
|
||||
private final JComboBox deckComboBox = new JComboBox();
|
||||
|
||||
/** The event button. */
|
||||
private final JButton eventButton = new JButton("Challenges");
|
||||
|
||||
/** The play button. */
|
||||
private final JButton playButton = new JButton("Play");
|
||||
|
||||
private QuestSelectablePanel selectedOpponent;
|
||||
|
||||
/** The next match panel. */
|
||||
private final JPanel nextMatchPanel = new JPanel();
|
||||
|
||||
/** The next match layout. */
|
||||
private CardLayout nextMatchLayout;
|
||||
|
||||
/** The is showing challenges. */
|
||||
private boolean isShowingChallenges = false;
|
||||
private final JCheckBox devModeCheckBox = new JCheckBox("Developer Mode");
|
||||
// private JCheckBox newGUICheckbox = new JCheckBox("Use new UI", true);
|
||||
private final JCheckBox smoothLandCheckBox = new JCheckBox("Adjust AI Land");
|
||||
private final JCheckBox petCheckBox = new JCheckBox("Summon Pet");
|
||||
|
||||
private final JCheckBox plantBox = new JCheckBox("Summon Plant");
|
||||
/** Constant <code>NO_DECKS_AVAILABLE="No decks available"</code>. */
|
||||
private static final String NO_DECKS_AVAILABLE = "No decks available";
|
||||
/** Constant <code>DUELS="Duels"</code>. */
|
||||
private static final String DUELS = "Duels";
|
||||
/** Constant <code>CHALLENGES="Challenges"</code>. */
|
||||
private static final String CHALLENGES = "Challenges";
|
||||
|
||||
// TODO: Make this ordering permanent
|
||||
/**
|
||||
* Constant <code>lastUsedDeck</code>
|
||||
* .
|
||||
*/
|
||||
private static String lastUsedDeck;
|
||||
private final JButton zeppelinButton = new JButton("<html>Launch<br>Zeppelin</html>", GuiUtils.getResizedIcon(
|
||||
GuiUtils.getIconFromFile("ZeppelinIcon.png"), 40, 40));
|
||||
private final JPanel zeppelinPanel = new JPanel();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for QuestMainPanel.
|
||||
* </p>
|
||||
*
|
||||
* @param mainFrame
|
||||
* a {@link forge.quest.gui.QuestFrame} object.
|
||||
*/
|
||||
public QuestMainPanel(final QuestFrame mainFrame) {
|
||||
super(mainFrame);
|
||||
this.questData = AllZone.getQuestData();
|
||||
this.qem = AllZone.getQuestEventManager();
|
||||
|
||||
// QuestEventManager is the MODEL for this VIEW.
|
||||
// All quest events are generated here, the first time the VIEW is made.
|
||||
if (this.qem == null) {
|
||||
this.qem = new QuestEventManager();
|
||||
this.qem.assembleAllEvents();
|
||||
AllZone.setQuestEventManager(this.qem);
|
||||
}
|
||||
|
||||
this.initUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* initUI.
|
||||
* </p>
|
||||
*/
|
||||
private void initUI() {
|
||||
this.refresh();
|
||||
this.setLayout(new BorderLayout(5, 5));
|
||||
final JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
this.add(centerPanel, BorderLayout.CENTER);
|
||||
|
||||
final JPanel northPanel = this.createStatusPanel();
|
||||
this.add(northPanel, BorderLayout.NORTH);
|
||||
|
||||
final JPanel eastPanel = this.createSidePanel();
|
||||
this.add(eastPanel, BorderLayout.EAST);
|
||||
|
||||
final JPanel matchSettingsPanel = this.createMatchSettingsPanel();
|
||||
centerPanel.add(matchSettingsPanel, BorderLayout.SOUTH);
|
||||
|
||||
centerPanel.add(this.nextMatchPanel, BorderLayout.CENTER);
|
||||
this.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* createStatusPanel.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
private JPanel createStatusPanel() {
|
||||
final JPanel northPanel = new JPanel();
|
||||
JLabel modeLabel;
|
||||
JLabel difficultyLabel; // Create labels at the top
|
||||
this.titleLabel.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
|
||||
this.titleLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
|
||||
northPanel.add(this.titleLabel);
|
||||
|
||||
northPanel.add(Box.createVerticalStrut(5));
|
||||
|
||||
final JPanel statusPanel = new JPanel();
|
||||
statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
|
||||
statusPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
|
||||
modeLabel = new JLabel(this.questData.getMode());
|
||||
statusPanel.add(modeLabel);
|
||||
statusPanel.add(Box.createHorizontalGlue());
|
||||
|
||||
difficultyLabel = new JLabel(this.questData.getDifficulty());
|
||||
statusPanel.add(difficultyLabel);
|
||||
statusPanel.add(Box.createHorizontalGlue());
|
||||
|
||||
statusPanel.add(this.statsLabel);
|
||||
|
||||
northPanel.add(statusPanel);
|
||||
return northPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* createSidePanel.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
private JPanel createSidePanel() {
|
||||
final JPanel panel = new JPanel();
|
||||
JPanel optionsPanel; // Create options checkbox list
|
||||
optionsPanel = this.createOptionsPanel();
|
||||
|
||||
final List<Component> eastComponents = new ArrayList<Component>();
|
||||
// Create buttons
|
||||
|
||||
final JButton mainMenuButton = new JButton("Return to Main Menu");
|
||||
mainMenuButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.getMainFrame().returnToMainMenu();
|
||||
}
|
||||
});
|
||||
eastComponents.add(mainMenuButton);
|
||||
|
||||
final JButton cardShopButton = new JButton("Card Shop");
|
||||
cardShopButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.showCardShop();
|
||||
}
|
||||
});
|
||||
eastComponents.add(cardShopButton);
|
||||
cardShopButton.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 20));
|
||||
|
||||
JButton bazaarButton = null;
|
||||
if (this.questData.getMode().equals(forge.quest.data.QuestData.FANTASY)) {
|
||||
|
||||
bazaarButton = new JButton("Bazaar");
|
||||
bazaarButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.showBazaar();
|
||||
}
|
||||
});
|
||||
eastComponents.add(bazaarButton);
|
||||
bazaarButton.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 20));
|
||||
}
|
||||
|
||||
this.eventButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.showChallenges();
|
||||
}
|
||||
});
|
||||
eastComponents.add(this.eventButton);
|
||||
this.eventButton.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 18));
|
||||
this.eventButton.setPreferredSize(new Dimension(0, 60));
|
||||
|
||||
this.playButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.launchGame();
|
||||
}
|
||||
});
|
||||
|
||||
this.playButton.setFont(new Font(Font.DIALOG, Font.BOLD, 28));
|
||||
this.playButton.setPreferredSize(new Dimension(0, 100));
|
||||
|
||||
eastComponents.add(this.playButton);
|
||||
eastComponents.add(optionsPanel);
|
||||
|
||||
GuiUtils.setWidthToMax(eastComponents);
|
||||
|
||||
panel.add(mainMenuButton);
|
||||
GuiUtils.addGap(panel);
|
||||
panel.add(optionsPanel);
|
||||
panel.add(Box.createVerticalGlue());
|
||||
panel.add(Box.createVerticalGlue());
|
||||
|
||||
if (this.questData.getMode().equals(forge.quest.data.QuestData.FANTASY)) {
|
||||
panel.add(this.lifeLabel);
|
||||
this.lifeLabel.setFont(new Font(Font.DIALOG, Font.BOLD, 14));
|
||||
this.lifeLabel.setIcon(GuiUtils.getResizedIcon(GuiUtils.getIconFromFile("Life.png"), 30, 30));
|
||||
}
|
||||
|
||||
GuiUtils.addGap(panel);
|
||||
panel.add(this.creditsLabel);
|
||||
this.creditsLabel.setIcon(GuiUtils.getResizedIcon(GuiUtils.getIconFromFile("CoinStack.png"), 30, 30));
|
||||
this.creditsLabel.setFont(new Font(Font.DIALOG, Font.BOLD, 14));
|
||||
GuiUtils.addGap(panel, 10);
|
||||
panel.add(cardShopButton);
|
||||
|
||||
if (this.questData.getMode().equals(forge.quest.data.QuestData.FANTASY)) {
|
||||
GuiUtils.addGap(panel);
|
||||
panel.add(bazaarButton);
|
||||
}
|
||||
|
||||
panel.add(Box.createVerticalGlue());
|
||||
|
||||
panel.add(this.eventButton);
|
||||
this.nextQuestLabel.setFont(new Font(Font.DIALOG, Font.PLAIN, 11));
|
||||
panel.add(this.nextQuestLabel);
|
||||
GuiUtils.addGap(panel);
|
||||
|
||||
panel.add(this.playButton);
|
||||
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
||||
return panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* createOptionsPanel.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
private JPanel createOptionsPanel() {
|
||||
JPanel optionsPanel;
|
||||
optionsPanel = new JPanel();
|
||||
optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
// optionsPanel.add(this.newGUICheckbox);
|
||||
optionsPanel.add(Box.createVerticalStrut(5));
|
||||
optionsPanel.add(this.smoothLandCheckBox);
|
||||
optionsPanel.add(Box.createVerticalStrut(5));
|
||||
optionsPanel.add(this.devModeCheckBox);
|
||||
optionsPanel.setBorder(new TitledBorder(new EtchedBorder(), "Options"));
|
||||
return optionsPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* createMatchSettingsPanel.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
private JPanel createMatchSettingsPanel() {
|
||||
|
||||
final JPanel matchPanel = new JPanel();
|
||||
matchPanel.setLayout(new BoxLayout(matchPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
final JPanel deckPanel = new JPanel();
|
||||
deckPanel.setLayout(new BoxLayout(deckPanel, BoxLayout.X_AXIS));
|
||||
|
||||
final JLabel deckLabel = new JLabel("Use Deck");
|
||||
deckPanel.add(deckLabel);
|
||||
GuiUtils.addGap(deckPanel);
|
||||
|
||||
this.deckComboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.playButton.setEnabled(QuestMainPanel.this.canGameBeLaunched());
|
||||
QuestMainPanel.lastUsedDeck = (String) QuestMainPanel.this.deckComboBox.getSelectedItem();
|
||||
}
|
||||
});
|
||||
|
||||
deckPanel.add(this.deckComboBox);
|
||||
GuiUtils.addGap(deckPanel);
|
||||
|
||||
final JButton editDeckButton = new JButton("Deck Editor");
|
||||
editDeckButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.showDeckEditor();
|
||||
}
|
||||
});
|
||||
deckPanel.add(editDeckButton);
|
||||
deckPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, deckPanel.getPreferredSize().height));
|
||||
deckPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
matchPanel.add(deckPanel);
|
||||
|
||||
GuiUtils.addGap(matchPanel);
|
||||
|
||||
if (this.questData.getMode().equals(forge.quest.data.QuestData.FANTASY)) {
|
||||
final JPanel fantasyPanel = new JPanel();
|
||||
fantasyPanel.setLayout(new BorderLayout());
|
||||
|
||||
final JPanel petPanel = new JPanel();
|
||||
petPanel.setLayout(new BoxLayout(petPanel, BoxLayout.X_AXIS));
|
||||
|
||||
this.petCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
if (QuestMainPanel.this.petCheckBox.isSelected()) {
|
||||
QuestMainPanel.this.questData.getPetManager().setSelectedPet(
|
||||
(String) QuestMainPanel.this.petComboBox.getSelectedItem());
|
||||
} else {
|
||||
QuestMainPanel.this.questData.getPetManager().setSelectedPet(null);
|
||||
}
|
||||
|
||||
QuestMainPanel.this.petComboBox.setEnabled(QuestMainPanel.this.petCheckBox.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
petPanel.add(this.petCheckBox);
|
||||
GuiUtils.addGap(petPanel);
|
||||
this.petComboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
if (QuestMainPanel.this.petCheckBox.isSelected()) {
|
||||
QuestMainPanel.this.questData.getPetManager().setSelectedPet(
|
||||
(String) QuestMainPanel.this.petComboBox.getSelectedItem());
|
||||
} else {
|
||||
QuestMainPanel.this.questData.getPetManager().setSelectedPet(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.petComboBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, (int) this.petCheckBox.getPreferredSize()
|
||||
.getHeight()));
|
||||
petPanel.add(this.petComboBox);
|
||||
|
||||
this.plantBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.questData.getPetManager()
|
||||
.setUsePlant(QuestMainPanel.this.plantBox.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
GuiUtils.addGap(petPanel, 10);
|
||||
petPanel.add(this.plantBox);
|
||||
petPanel.setMaximumSize(petPanel.getPreferredSize());
|
||||
petPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
|
||||
fantasyPanel.add(petPanel, BorderLayout.WEST);
|
||||
|
||||
this.zeppelinButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.questData.randomizeOpponents();
|
||||
QuestMainPanel.this.refreshNextMatchPanel();
|
||||
final QuestItemZeppelin zeppelin = (QuestItemZeppelin) QuestMainPanel.this.questData.getInventory()
|
||||
.getItem("Zeppelin");
|
||||
zeppelin.setZeppelinUsed(true);
|
||||
QuestMainPanel.this.zeppelinButton.setEnabled(false);
|
||||
}
|
||||
});
|
||||
|
||||
this.zeppelinButton.setMaximumSize(this.zeppelinButton.getPreferredSize());
|
||||
this.zeppelinPanel.setLayout(new BorderLayout());
|
||||
|
||||
fantasyPanel.add(this.zeppelinPanel, BorderLayout.EAST);
|
||||
fantasyPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
matchPanel.add(fantasyPanel);
|
||||
}
|
||||
return matchPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* createDuelPanel.
|
||||
* </p>
|
||||
* Makes a parent panel, then selectable panel instances for all available
|
||||
* duels.
|
||||
*
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
private JPanel createDuelPanel() {
|
||||
final JPanel duelPanel = new JPanel();
|
||||
QuestDuelPanel duelEvent;
|
||||
duelPanel.setLayout(new BoxLayout(duelPanel, BoxLayout.Y_AXIS));
|
||||
duelPanel.setBorder(new TitledBorder(new EtchedBorder(), "Available Duels"));
|
||||
|
||||
final List<QuestDuel> duels = this.qem.generateDuels();
|
||||
|
||||
for (final QuestDuel qd : duels) {
|
||||
duelEvent = new QuestDuelPanel(qd);
|
||||
duelPanel.add(duelEvent);
|
||||
duelEvent.addMouseListener(new SelectionAdapter(duelEvent));
|
||||
|
||||
GuiUtils.addGap(duelPanel, 3);
|
||||
}
|
||||
|
||||
duelPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
|
||||
return duelPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* createChallengePanel.
|
||||
* </p>
|
||||
* Makes a parent panel, then selectable panel instances for all available
|
||||
* challenges.
|
||||
*
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
private JPanel createChallengePanel() {
|
||||
final JPanel challengePanel = new JPanel();
|
||||
|
||||
QuestSelectablePanel selpan;
|
||||
challengePanel.setLayout(new BoxLayout(challengePanel, BoxLayout.Y_AXIS));
|
||||
challengePanel.setBorder(new TitledBorder(new EtchedBorder(), "Available Challenges"));
|
||||
|
||||
final List<QuestChallenge> challenges = this.qem.generateChallenges();
|
||||
|
||||
for (final QuestChallenge qc : challenges) {
|
||||
selpan = new QuestChallengePanel(qc);
|
||||
challengePanel.add(selpan);
|
||||
selpan.addMouseListener(new SelectionAdapter(selpan));
|
||||
|
||||
GuiUtils.addGap(challengePanel, 3);
|
||||
}
|
||||
|
||||
return challengePanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* refresh.
|
||||
* </p>
|
||||
*/
|
||||
final void refresh() {
|
||||
AllZone.getQuestData().saveData();
|
||||
|
||||
this.devModeCheckBox.setSelected(Constant.Runtime.DEV_MODE[0]);
|
||||
this.smoothLandCheckBox.setSelected(Constant.Runtime.SMOOTH[0]);
|
||||
|
||||
this.creditsLabel.setText(" " + this.questData.getCredits());
|
||||
this.statsLabel.setText(this.questData.getWin() + " wins / " + this.questData.getLost() + " losses");
|
||||
this.titleLabel.setText(this.questData.getRank());
|
||||
|
||||
// copy lastUsedDeck as removal triggers selection change.
|
||||
final String lastUsedDeck = QuestMainPanel.lastUsedDeck;
|
||||
this.deckComboBox.removeAllItems();
|
||||
|
||||
if (this.questData.getDeckNames().size() > 0) {
|
||||
this.deckComboBox.setEnabled(true);
|
||||
|
||||
final List<String> deckNames = new ArrayList<String>(this.questData.getDeckNames());
|
||||
|
||||
Collections.sort(deckNames, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(final String s, final String s1) {
|
||||
return s.compareToIgnoreCase(s1);
|
||||
}
|
||||
});
|
||||
|
||||
if (deckNames.contains(lastUsedDeck)) {
|
||||
deckNames.remove(lastUsedDeck);
|
||||
deckNames.add(0, lastUsedDeck);
|
||||
}
|
||||
|
||||
for (final String deckName : deckNames) {
|
||||
this.deckComboBox.addItem(deckName);
|
||||
}
|
||||
} else {
|
||||
this.deckComboBox.addItem(QuestMainPanel.NO_DECKS_AVAILABLE);
|
||||
this.deckComboBox.setEnabled(false);
|
||||
}
|
||||
this.deckComboBox.setMinimumSize(new Dimension(150, 0));
|
||||
|
||||
this.eventButton.setEnabled(this.nextChallengeInWins() == 0);
|
||||
|
||||
this.playButton.setEnabled(this.canGameBeLaunched());
|
||||
|
||||
if (this.questData.getMode().equals(QuestData.FANTASY)) {
|
||||
this.lifeLabel.setText(" " + this.questData.getLife());
|
||||
|
||||
this.petComboBox.removeAllItems();
|
||||
|
||||
final Set<String> petList = this.questData.getPetManager().getAvailablePetNames();
|
||||
|
||||
if (petList.size() > 0) {
|
||||
this.petComboBox.setEnabled(true);
|
||||
this.petCheckBox.setEnabled(true);
|
||||
for (final String aPetList : petList) {
|
||||
this.petComboBox.addItem(aPetList);
|
||||
}
|
||||
} else {
|
||||
this.petComboBox.addItem("No pets available");
|
||||
this.petComboBox.setEnabled(false);
|
||||
this.petCheckBox.setEnabled(false);
|
||||
}
|
||||
|
||||
if (!this.questData.getPetManager().shouldPetBeUsed()) {
|
||||
this.petCheckBox.setSelected(false);
|
||||
this.petComboBox.setEnabled(false);
|
||||
} else {
|
||||
this.petCheckBox.setSelected(true);
|
||||
this.petComboBox.setSelectedItem(this.questData.getPetManager().getSelectedPet().getName());
|
||||
}
|
||||
|
||||
this.plantBox.setEnabled(this.questData.getPetManager().getPlant().getLevel() > 0);
|
||||
this.plantBox.setSelected(this.questData.getPetManager().shouldPlantBeUsed());
|
||||
|
||||
final QuestItemZeppelin zeppelin = (QuestItemZeppelin) this.questData.getInventory().getItem("Zeppelin");
|
||||
|
||||
if (zeppelin.getLevel() > 0) {
|
||||
this.zeppelinPanel.removeAll();
|
||||
this.zeppelinPanel.add(this.zeppelinButton, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
if (!zeppelin.hasBeenUsed()) {
|
||||
this.zeppelinButton.setEnabled(true);
|
||||
} else {
|
||||
this.zeppelinButton.setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.nextChallengeInWins() > 0) {
|
||||
this.nextQuestLabel.setText("Next challenge in " + this.nextChallengeInWins() + " Wins.");
|
||||
} else {
|
||||
this.nextQuestLabel.setText("Next challenge available now.");
|
||||
}
|
||||
|
||||
this.nextMatchLayout = new CardLayout();
|
||||
|
||||
this.refreshNextMatchPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* refreshNextMatchPanel.
|
||||
* </p>
|
||||
*/
|
||||
private void refreshNextMatchPanel() {
|
||||
this.nextMatchPanel.removeAll();
|
||||
this.nextMatchLayout = new CardLayout();
|
||||
this.nextMatchPanel.setLayout(this.nextMatchLayout);
|
||||
this.nextMatchPanel.add(this.createDuelPanel(), QuestMainPanel.DUELS);
|
||||
this.nextMatchPanel.add(this.createChallengePanel(), QuestMainPanel.CHALLENGES);
|
||||
if (this.isShowingChallenges) {
|
||||
this.nextMatchLayout.show(this.nextMatchPanel, QuestMainPanel.CHALLENGES);
|
||||
} else {
|
||||
this.nextMatchLayout.show(this.nextMatchPanel, QuestMainPanel.DUELS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* nextChallengeInWins.
|
||||
* </p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
private int nextChallengeInWins() {
|
||||
|
||||
// Number of wins was 25, lowereing the number to 20 to help short term
|
||||
// questers.
|
||||
if (this.questData.getWin() < 20) {
|
||||
return 20 - this.questData.getWin();
|
||||
}
|
||||
|
||||
// The int mul has been lowered by one, should face special opps more
|
||||
// frequently.
|
||||
final int challengesPlayed = this.questData.getChallengesPlayed();
|
||||
int mul = 5;
|
||||
|
||||
if (this.questData.getInventory().hasItem("Zeppelin")) {
|
||||
mul = 3;
|
||||
} else if (this.questData.getInventory().hasItem("Map")) {
|
||||
mul = 4;
|
||||
}
|
||||
|
||||
final int delta = (challengesPlayed * mul) - this.questData.getWin();
|
||||
|
||||
return (delta > 0) ? delta : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showDeckEditor.
|
||||
* </p>
|
||||
*/
|
||||
final void showDeckEditor() {
|
||||
final Command exit = new Command() {
|
||||
private static final long serialVersionUID = -5110231879431074581L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
// saves all deck data
|
||||
AllZone.getQuestData().saveData();
|
||||
|
||||
new QuestFrame();
|
||||
}
|
||||
};
|
||||
|
||||
final DeckEditorQuest g = new DeckEditorQuest(AllZone.getQuestData());
|
||||
|
||||
g.show(exit);
|
||||
g.setVisible(true);
|
||||
this.getMainFrame().dispose();
|
||||
} // deck editor button
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showBazaar.
|
||||
* </p>
|
||||
*/
|
||||
final void showBazaar() {
|
||||
this.getMainFrame().showBazaarPane();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showCardShop.
|
||||
* </p>
|
||||
*/
|
||||
final void showCardShop() {
|
||||
final Command exit = new Command() {
|
||||
private static final long serialVersionUID = 8567193482568076362L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
// saves all deck data
|
||||
AllZone.getQuestData().saveData();
|
||||
|
||||
new QuestFrame();
|
||||
}
|
||||
};
|
||||
|
||||
final DeckEditorShop g = new DeckEditorShop(this.questData);
|
||||
|
||||
g.show(exit);
|
||||
g.setVisible(true);
|
||||
|
||||
this.getMainFrame().dispose();
|
||||
|
||||
} // card shop button
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* launchGame.
|
||||
* </p>
|
||||
*/
|
||||
private void launchGame() {
|
||||
// TODO This is a temporary hack to see if the image cache affects the
|
||||
// heap usage significantly.
|
||||
ImageCache.clear();
|
||||
|
||||
final QuestItemZeppelin zeppelin = (QuestItemZeppelin) this.questData.getInventory().getItem("Zeppelin");
|
||||
zeppelin.setZeppelinUsed(false);
|
||||
this.questData.randomizeOpponents();
|
||||
|
||||
final String humanDeckName = (String) this.deckComboBox.getSelectedItem();
|
||||
|
||||
final Deck humanDeck = this.questData.getDeck(humanDeckName);
|
||||
|
||||
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
||||
this.moveDeckToTop(humanDeckName);
|
||||
|
||||
Constant.Quest.OPP_ICON_NAME[0] = this.getEventIconFilename();
|
||||
|
||||
|
||||
GuiTopLevel g = (GuiTopLevel) AllZone.getDisplay();
|
||||
g.getController().changeState(FControl.MATCH_SCREEN);
|
||||
g.getController().getMatchController().initMatch();
|
||||
|
||||
Constant.Runtime.SMOOTH[0] = this.smoothLandCheckBox.isSelected();
|
||||
|
||||
AllZone.getMatchState().reset();
|
||||
if (this.isShowingChallenges) {
|
||||
this.setupChallenge(humanDeck);
|
||||
} else {
|
||||
this.setupDuel(humanDeck);
|
||||
}
|
||||
|
||||
AllZone.getQuestData().saveData();
|
||||
|
||||
AllZone.getDisplay().setVisible(true);
|
||||
this.getMainFrame().dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* setupDuel.
|
||||
* </p>
|
||||
*
|
||||
* @param humanDeck
|
||||
* a {@link forge.deck.Deck} object.
|
||||
*/
|
||||
final void setupDuel(final Deck humanDeck) {
|
||||
final Deck computer = this.selectedOpponent.getEvent().getEventDeck();
|
||||
Constant.Runtime.COMPUTER_DECK[0] = computer;
|
||||
|
||||
final QuestDuel selectedDuel = (QuestDuel) this.selectedOpponent.getEvent();
|
||||
AllZone.setQuestEvent(selectedDuel);
|
||||
|
||||
AllZone.getGameAction().newGame(humanDeck, computer, QuestUtil.getHumanStartingCards(this.questData),
|
||||
QuestUtil.getComputerStartingCards(this.questData), this.questData.getLife(), 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* setupChallenge.
|
||||
* </p>
|
||||
*
|
||||
* @param humanDeck
|
||||
* a {@link forge.deck.Deck} object.
|
||||
*/
|
||||
private void setupChallenge(final Deck humanDeck) {
|
||||
final QuestChallenge selectedChallenge = (QuestChallenge) this.selectedOpponent.getEvent();
|
||||
|
||||
final Deck computer = this.selectedOpponent.getEvent().getEventDeck();
|
||||
Constant.Runtime.COMPUTER_DECK[0] = computer;
|
||||
|
||||
AllZone.setQuestEvent(selectedChallenge);
|
||||
|
||||
int extraLife = 0;
|
||||
|
||||
if (this.questData.getInventory().getItemLevel("Gear") == 2) {
|
||||
extraLife = 3;
|
||||
}
|
||||
|
||||
AllZone.getGameAction().newGame(humanDeck, computer,
|
||||
QuestUtil.getHumanStartingCards(this.questData, selectedChallenge),
|
||||
QuestUtil.getComputerStartingCards(this.questData, selectedChallenge),
|
||||
this.questData.getLife() + extraLife, selectedChallenge.getAILife());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getEventIconFilename.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
private String getEventIconFilename() {
|
||||
return this.selectedOpponent.getIconFilename();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showChallenges.
|
||||
* </p>
|
||||
*/
|
||||
final void showChallenges() {
|
||||
if (this.isShowingChallenges) {
|
||||
this.isShowingChallenges = false;
|
||||
this.eventButton.setText("Challenges");
|
||||
} else {
|
||||
this.isShowingChallenges = true;
|
||||
this.eventButton.setText("Duels");
|
||||
}
|
||||
|
||||
if (this.selectedOpponent != null) {
|
||||
this.selectedOpponent.setSelected(false);
|
||||
}
|
||||
|
||||
this.selectedOpponent = null;
|
||||
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class SelectionAdapter.
|
||||
*/
|
||||
class SelectionAdapter extends MouseAdapter {
|
||||
|
||||
/** The selectable panel. */
|
||||
private final QuestSelectablePanel selectablePanel;
|
||||
|
||||
/**
|
||||
* Instantiates a new selection adapter.
|
||||
*
|
||||
* @param selectablePanel
|
||||
* the selectable panel
|
||||
*/
|
||||
SelectionAdapter(final QuestSelectablePanel selectablePanel) {
|
||||
super();
|
||||
this.selectablePanel = selectablePanel;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
|
||||
*/
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent mouseEvent) {
|
||||
|
||||
if (QuestMainPanel.this.selectedOpponent != null) {
|
||||
QuestMainPanel.this.selectedOpponent.setSelected(false);
|
||||
}
|
||||
|
||||
this.selectablePanel.setSelected(true);
|
||||
|
||||
QuestMainPanel.this.selectedOpponent = this.selectablePanel;
|
||||
QuestMainPanel.this.playButton.setEnabled(QuestMainPanel.this.canGameBeLaunched());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* moveDeckToTop.
|
||||
* </p>
|
||||
*
|
||||
* @param humanDeckName
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
private void moveDeckToTop(final String humanDeckName) {
|
||||
QuestMainPanel.lastUsedDeck = humanDeckName;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* canGameBeLaunched.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
final boolean canGameBeLaunched() {
|
||||
return !(QuestMainPanel.NO_DECKS_AVAILABLE.equals(this.deckComboBox.getSelectedItem()) || (this.selectedOpponent == null));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void refreshState() {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.quest.data.QuestData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Gui_QuestOptions class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestOptions extends JFrame {
|
||||
/** Constant <code>serialVersionUID=2018518804206822235L</code>. */
|
||||
private static final long serialVersionUID = 2018518804206822235L;
|
||||
|
||||
private final QuestData questData = new QuestData();
|
||||
|
||||
private final JLabel jLabel1 = new JLabel();
|
||||
private final JButton continueQuestButton = new JButton();
|
||||
private final JPanel jPanel1 = new JPanel();
|
||||
private final JPanel jPanel2 = new JPanel();
|
||||
private final GridLayout gridLayout1 = new GridLayout();
|
||||
|
||||
private final JRadioButton easyRadio = new JRadioButton();
|
||||
private final JRadioButton hardRadio = new JRadioButton();
|
||||
private final JRadioButton mediumRadio = new JRadioButton();
|
||||
private final JRadioButton veryHardRadio = new JRadioButton();
|
||||
|
||||
private final JRadioButton fantasyRadio = new JRadioButton();
|
||||
private final JRadioButton classicRadio = new JRadioButton();
|
||||
|
||||
private final JCheckBox cbStandardStart = new JCheckBox();
|
||||
|
||||
private final JButton newQuestButton = new JButton();
|
||||
private final JTextArea jTextArea1 = new JTextArea();
|
||||
private final ButtonGroup buttonGroup1 = new ButtonGroup();
|
||||
private final ButtonGroup buttonGroup2 = new ButtonGroup();
|
||||
private final JPanel jPanel3 = new JPanel();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Gui_QuestOptions.
|
||||
* </p>
|
||||
*/
|
||||
public QuestOptions() {
|
||||
try {
|
||||
this.jbInit();
|
||||
} catch (final Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
}
|
||||
|
||||
this.setup();
|
||||
this.setupRadioButtonText();
|
||||
|
||||
this.setSize(540, 555);
|
||||
GuiUtils.centerFrame(this);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* setup.
|
||||
* </p>
|
||||
*/
|
||||
private void setup() {
|
||||
// make the text look correct on the screen
|
||||
this.jTextArea1.setBackground(this.getBackground());
|
||||
|
||||
// if user closes this window, go back to "New Game" screen
|
||||
this.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent ev) {
|
||||
QuestOptions.this.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
// is there any saved data?
|
||||
//if (!this.questData.hasSaveFile()) {
|
||||
// this.continueQuestButton.setEnabled(false);
|
||||
//}
|
||||
} // setup()
|
||||
|
||||
// show total number of games for each difficulty
|
||||
/**
|
||||
* <p>
|
||||
* setupRadioButtonText.
|
||||
* </p>
|
||||
*/
|
||||
private void setupRadioButtonText() {
|
||||
/*final String[] diff = QuestPreferences.getDifficulty();
|
||||
final JRadioButton[] b = { this.easyRadio, this.mediumRadio, this.hardRadio, this.veryHardRadio };
|
||||
|
||||
for (int i = 0; i < diff.length; i++) {
|
||||
// -2 because you start a level 1, and the last level is secret
|
||||
final int numberLevels = QuestData.RANK_TITLES.length - 2;
|
||||
final int numGames = numberLevels * QuestPreferences.getWinsForRankIncrease(i);
|
||||
|
||||
b[i].setText(String.format("%s - %d", diff[i], numGames));
|
||||
}*/
|
||||
|
||||
} // setupRadioButtonText()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* jbInit.
|
||||
* </p>
|
||||
*
|
||||
* @throws java.lang.Exception
|
||||
* if any.
|
||||
*/
|
||||
private void jbInit() throws Exception {
|
||||
final TitledBorder titledBorder1 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(
|
||||
148, 145, 140)), "Quest Length");
|
||||
final Border border2 = BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140));
|
||||
final TitledBorder titledBorder2 = new TitledBorder(border2, "Continue");
|
||||
this.jLabel1.setFont(new java.awt.Font("Dialog", 0, 25));
|
||||
this.jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.jLabel1.setText("Quest Options");
|
||||
this.jLabel1.setBounds(new Rectangle(1, 0, 539, 63));
|
||||
this.setTitle("Quest Options");
|
||||
this.getContentPane().setLayout(null);
|
||||
this.continueQuestButton.setBounds(new Rectangle(69, 28, 179, 35));
|
||||
this.continueQuestButton.setFont(new java.awt.Font("Dialog", 0, 18));
|
||||
this.continueQuestButton.setText("Continue Quest");
|
||||
this.continueQuestButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
QuestOptions.this.continueQuestButtonActionPerformed(e);
|
||||
}
|
||||
});
|
||||
this.jPanel1.setBorder(titledBorder1);
|
||||
this.jPanel1.setBounds(new Rectangle(20, 63, 500, 353));
|
||||
this.jPanel1.setLayout(null);
|
||||
|
||||
this.jPanel2.setBounds(new Rectangle(20, 27, 460, 101));
|
||||
this.jPanel2.setLayout(this.gridLayout1);
|
||||
|
||||
this.gridLayout1.setColumns(2);
|
||||
this.gridLayout1.setRows(4);
|
||||
|
||||
this.easyRadio.setText("Easy - 50 games");
|
||||
this.mediumRadio.setText("Medium - 100 games");
|
||||
this.hardRadio.setText("Hard - 200 games");
|
||||
this.veryHardRadio.setText("Very Hard - 300 games");
|
||||
this.classicRadio.setText("Classic");
|
||||
this.fantasyRadio.setText("Fantasy");
|
||||
|
||||
this.easyRadio.setSelected(true);
|
||||
this.classicRadio.setSelected(true);
|
||||
|
||||
this.cbStandardStart.setText("Standard (Type 2) Starting Pool");
|
||||
|
||||
this.newQuestButton.setBounds(new Rectangle(179, 292, 140, 38));
|
||||
this.newQuestButton.setFont(new java.awt.Font("Dialog", 0, 16));
|
||||
this.newQuestButton.setText("New Quest");
|
||||
this.newQuestButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
QuestOptions.this.newQuestButtonActionPerformed(e);
|
||||
}
|
||||
});
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("New Quest will delete your current player decks, credits and win loss record. ");
|
||||
sb.append("Continue Quest will allow you to continue a quest that you started at an earlier time.");
|
||||
sb.append("\r\n");
|
||||
sb.append("\r\n");
|
||||
sb.append("Fantasy adds a Bazaar and the occasional fantasy themed opponent for you to battle.");
|
||||
|
||||
this.jTextArea1.setBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)));
|
||||
this.jTextArea1.setEnabled(false);
|
||||
this.jTextArea1.setFont(new java.awt.Font("Dialog", 0, 12));
|
||||
this.jTextArea1.setDisabledTextColor(Color.black);
|
||||
this.jTextArea1.setEditable(false);
|
||||
// jTextArea1.setText("Note: Starting a new quest will delete your current quest data");
|
||||
this.jTextArea1.setText(sb.toString());
|
||||
this.jTextArea1.setLineWrap(true);
|
||||
this.jTextArea1.setWrapStyleWord(true);
|
||||
this.jTextArea1.setBounds(new Rectangle(86, 145, 327, 128));
|
||||
|
||||
this.jPanel3.setBorder(titledBorder2);
|
||||
this.jPanel3.setBounds(new Rectangle(110, 427, 323, 86));
|
||||
this.jPanel3.setLayout(null);
|
||||
|
||||
this.jPanel2.add(this.easyRadio, null);
|
||||
this.jPanel2.add(this.classicRadio, null);
|
||||
this.jPanel2.add(this.mediumRadio, null);
|
||||
this.jPanel2.add(this.fantasyRadio, null);
|
||||
this.jPanel2.add(this.hardRadio, null);
|
||||
this.jPanel2.add(new JLabel("")); // for empty cell
|
||||
this.jPanel2.add(this.veryHardRadio, null);
|
||||
this.jPanel2.add(this.cbStandardStart, null);
|
||||
|
||||
this.jPanel1.add(this.newQuestButton, null);
|
||||
this.jPanel1.add(this.jTextArea1, null);
|
||||
this.getContentPane().add(this.jPanel1, null);
|
||||
this.getContentPane().add(this.jPanel3, null);
|
||||
this.jPanel3.add(this.continueQuestButton, null);
|
||||
this.getContentPane().add(this.jLabel1, null);
|
||||
this.jPanel1.add(this.jPanel2, null);
|
||||
this.buttonGroup1.add(this.easyRadio);
|
||||
this.buttonGroup1.add(this.mediumRadio);
|
||||
this.buttonGroup1.add(this.hardRadio);
|
||||
this.buttonGroup1.add(this.veryHardRadio);
|
||||
|
||||
this.buttonGroup2.add(this.classicRadio);
|
||||
this.buttonGroup2.add(this.fantasyRadio);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* continueQuestButton_actionPerformed.
|
||||
* </p>
|
||||
*
|
||||
* @param e
|
||||
* a {@link java.awt.event.ActionEvent} object.
|
||||
*/
|
||||
final void continueQuestButtonActionPerformed(final ActionEvent e) {
|
||||
// set global variable
|
||||
/*AllZone.setQuestData(QuestDataIO.loadData());
|
||||
AllZone.getQuestData().guessDifficultyIndex();
|
||||
this.dispose();
|
||||
|
||||
new QuestFrame();
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* newQuestButton_actionPerformed.
|
||||
* </p>
|
||||
*
|
||||
* @param e
|
||||
* a {@link java.awt.event.ActionEvent} object.
|
||||
*/
|
||||
final void newQuestButtonActionPerformed(final ActionEvent e) {
|
||||
int difficulty = 0;
|
||||
|
||||
final String mode = this.fantasyRadio.isSelected() ? forge.quest.data.QuestData.FANTASY
|
||||
: forge.quest.data.QuestData.CLASSIC;
|
||||
|
||||
if (this.easyRadio.isSelected()) {
|
||||
difficulty = 0;
|
||||
} else if (this.mediumRadio.isSelected()) {
|
||||
difficulty = 1;
|
||||
} else if (this.hardRadio.isSelected()) {
|
||||
difficulty = 2;
|
||||
} else if (this.veryHardRadio.isSelected()) {
|
||||
difficulty = 3;
|
||||
} else {
|
||||
// user didn't select a difficulty{
|
||||
return;
|
||||
}
|
||||
|
||||
/* if (this.questData.hasSaveFile()) {
|
||||
// this will overwrite your save file!
|
||||
final Object[] possibleValues = { "Yes", "No" };
|
||||
final Object choice = JOptionPane.showOptionDialog(null,
|
||||
"Starting a new quest will overwrite your current quest. Continue?", "Start New Quest?",
|
||||
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, possibleValues, possibleValues[1]);
|
||||
|
||||
if (!choice.equals(0)) {
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
// give the user a few cards to build a deck
|
||||
this.questData.newGame(difficulty, mode, this.cbStandardStart.isSelected());
|
||||
|
||||
this.questData.saveData();
|
||||
|
||||
// set global variable
|
||||
AllZone.setQuestData(this.questData);
|
||||
|
||||
this.dispose();
|
||||
new QuestFrame();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
package forge.quest.gui.bazaar;
|
||||
|
||||
import forge.quest.gui.QuestAbstractPanel;
|
||||
import forge.quest.gui.QuestFrame;
|
||||
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
package forge.quest.gui.bazaar;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JToggleButton;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.control.FControl;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.quest.gui.QuestAbstractPanel;
|
||||
import forge.quest.gui.QuestFrame;
|
||||
import forge.view.GuiTopLevel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestBazaarPanel class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestBazaarPanel extends QuestAbstractPanel {
|
||||
/**
|
||||
* TODO: Write javadoc for Constructor.
|
||||
* @param mainFrame
|
||||
*/
|
||||
protected QuestBazaarPanel(QuestFrame mainFrame) {
|
||||
super(mainFrame);
|
||||
// TODO Auto-generated constructor stub
|
||||
throw new net.slightlymagic.braids.util.NotImplementedError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshState() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new net.slightlymagic.braids.util.NotImplementedError();
|
||||
}
|
||||
/*
|
||||
/** Constant <code>serialVersionUID=1418913010051869222L</code>. *
|
||||
private static final long serialVersionUID = 1418913010051869222L;
|
||||
|
||||
/** Constant <code>stallList</code>. *
|
||||
private static List<QuestBazaarStall> stallList = new ArrayList<QuestBazaarStall>();
|
||||
|
||||
/** The button panel. *
|
||||
private final JPanel buttonPanel = new JPanel(new BorderLayout());
|
||||
|
||||
/** The button panel main. *
|
||||
private final JPanel buttonPanelMain = new JPanel();
|
||||
|
||||
/** The stall panel. *
|
||||
private final JPanel stallPanel = new JPanel();
|
||||
|
||||
/** The selected stall. *
|
||||
private JToggleButton selectedStall = null;
|
||||
|
||||
/** The stall layout. *
|
||||
private final CardLayout stallLayout = new CardLayout();
|
||||
|
||||
|
||||
public QuestBazaarPanel(final QuestFrame mainFrame) {
|
||||
super(mainFrame);
|
||||
this.setLayout(new BorderLayout());
|
||||
|
||||
QuestBazaarPanel.stallList = new ArrayList<QuestBazaarStall>();
|
||||
|
||||
for (final String stallName : QuestStallManager.getStallNames()) {
|
||||
QuestBazaarPanel.stallList.add(new QuestBazaarStall(QuestStallManager.getStall(stallName)));
|
||||
}
|
||||
|
||||
this.buttonPanelMain.setLayout(new GridLayout(QuestBazaarPanel.stallList.size(), 1));
|
||||
|
||||
this.stallPanel.setLayout(this.stallLayout);
|
||||
final List<JToggleButton> buttonList = new LinkedList<JToggleButton>();
|
||||
|
||||
double maxWidth = 0;
|
||||
double maxHeight = 0;
|
||||
|
||||
for (final QuestBazaarStall stall : QuestBazaarPanel.stallList) {
|
||||
final JToggleButton stallButton = new JToggleButton(stall.getStallName(), stall.getStallIcon());
|
||||
stallButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
||||
if (QuestBazaarPanel.this.selectedStall == e.getSource()) {
|
||||
QuestBazaarPanel.this.selectedStall.setSelected(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (QuestBazaarPanel.this.selectedStall != null) {
|
||||
QuestBazaarPanel.this.selectedStall.setSelected(false);
|
||||
}
|
||||
|
||||
QuestBazaarPanel.this.showStall(((JToggleButton) e.getSource()).getText());
|
||||
QuestBazaarPanel.this.selectedStall = (JToggleButton) e.getSource();
|
||||
}
|
||||
});
|
||||
|
||||
final Dimension preferredSize = stallButton.getPreferredSize();
|
||||
|
||||
if (preferredSize.getWidth() > maxWidth) {
|
||||
maxWidth = preferredSize.getWidth();
|
||||
}
|
||||
|
||||
if (preferredSize.getHeight() > maxHeight) {
|
||||
maxHeight = preferredSize.getHeight();
|
||||
}
|
||||
|
||||
buttonList.add(stallButton);
|
||||
|
||||
this.buttonPanelMain.add(stallButton);
|
||||
this.stallPanel.add(stall, stall.getStallName());
|
||||
}
|
||||
|
||||
buttonList.get(0).setSelected(true);
|
||||
this.selectedStall = buttonList.get(0);
|
||||
|
||||
final Dimension max = new Dimension((int) maxWidth, (int) maxHeight);
|
||||
|
||||
for (final JToggleButton button : buttonList) {
|
||||
button.setMinimumSize(max);
|
||||
}
|
||||
|
||||
this.buttonPanel.add(this.buttonPanelMain, BorderLayout.NORTH);
|
||||
final JButton quitButton = new JButton("Leave Bazaar");
|
||||
quitButton.setSize(max);
|
||||
quitButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
FControl g = ((GuiTopLevel) AllZone.getDisplay()).getController();
|
||||
g.changeState(FControl.HOME_SCREEN);
|
||||
g.getHomeView().showQuestMenu();
|
||||
}
|
||||
});
|
||||
|
||||
this.buttonPanel.add(quitButton, BorderLayout.SOUTH);
|
||||
|
||||
this.add(this.buttonPanel, BorderLayout.WEST);
|
||||
this.add(this.stallPanel, BorderLayout.CENTER);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* showStall.
|
||||
* </p>
|
||||
*
|
||||
* @param source
|
||||
* a {@link java.lang.String} object.
|
||||
*
|
||||
private void showStall(final String source) {
|
||||
this.stallLayout.show(this.stallPanel, source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Slightly hackish, but should work.
|
||||
*
|
||||
static void refreshLastInstance() {
|
||||
for (final QuestBazaarStall stall : QuestBazaarPanel.stallList) {
|
||||
stall.updateItems();
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} *
|
||||
@Override
|
||||
public final void refreshState() {
|
||||
QuestBazaarPanel.refreshLastInstance();
|
||||
} */
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.quest.gui.QuestAbstractPanel#refreshState()
|
||||
*/
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
/** Forge Card Game. */
|
||||
package forge.quest.gui.bazaar;
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui.main;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.quest.data.QuestChallenge;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestQuestPanel.
|
||||
* </p>
|
||||
* VIEW - Creates a QuestSelectablePanel instance for a "quest" style event.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class QuestChallengePanel extends QuestSelectablePanel {
|
||||
|
||||
private JLabel repeatabilityLabel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestChallengePanel.
|
||||
* </p>
|
||||
* Constructor, using challenge data instance.
|
||||
*
|
||||
* @param q
|
||||
* the q
|
||||
*/
|
||||
public QuestChallengePanel(final QuestChallenge q) {
|
||||
super(q);
|
||||
|
||||
GuiUtils.addGap(super.getRootPanel(), 7);
|
||||
|
||||
if (q.getRepeatable()) {
|
||||
this.repeatabilityLabel = new JLabel("This challenge is repeatable");
|
||||
} else {
|
||||
this.repeatabilityLabel = new JLabel("This challenge is not repeatable");
|
||||
}
|
||||
|
||||
super.getRootPanel().add(this.repeatabilityLabel);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui.main;
|
||||
|
||||
import forge.quest.data.QuestDuel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestDuelPanel.
|
||||
* </p>
|
||||
* VIEW - Creates a QuestSelectablePanel instance for a "battle" style event.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class QuestDuelPanel extends QuestSelectablePanel {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestDuelPanel.
|
||||
* </p>
|
||||
* Constructor, using duel data instance.
|
||||
*
|
||||
* @param d
|
||||
* the d
|
||||
*/
|
||||
public QuestDuelPanel(final QuestDuel d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui.main;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.data.QuestEvent;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* QuestSelectablePanel class.
|
||||
* </p>
|
||||
* VIEW - Creates a selectable panel, used for picking events.
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class QuestSelectablePanel extends JPanel {
|
||||
/** Constant <code>serialVersionUID=-1502285997894190742L</code>. */
|
||||
private static final long serialVersionUID = -1502285997894190742L;
|
||||
|
||||
/** The background color. */
|
||||
private final Color backgroundColor;
|
||||
private boolean selected;
|
||||
private final QuestEvent event;
|
||||
private String iconfilename;
|
||||
|
||||
/** The root panel. */
|
||||
private JPanel rootPanel = new JPanel();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for QuestSelectablePanel.
|
||||
* </p>
|
||||
* VIEW - A JPanel for selecting quest events.
|
||||
*
|
||||
* @param qe
|
||||
* the qe
|
||||
*/
|
||||
public QuestSelectablePanel(final QuestEvent qe) {
|
||||
this.event = qe;
|
||||
this.iconfilename = qe.getIconFilename();
|
||||
final File base = ForgeProps.getFile(NewConstants.IMAGE_ICON);
|
||||
File file = new File(base, this.iconfilename);
|
||||
|
||||
final ImageIcon icon;
|
||||
if (!file.exists()) {
|
||||
icon = Singletons.getView().getSkin().getIcon(FSkin.ForgeIcons.ICO_UNKNOWN);
|
||||
}
|
||||
else {
|
||||
icon = new ImageIcon(file.toString());
|
||||
}
|
||||
|
||||
this.backgroundColor = this.getBackground();
|
||||
this.setLayout(new BorderLayout(5, 5));
|
||||
|
||||
JLabel iconLabel;
|
||||
|
||||
if (icon.getIconHeight() == -1) {
|
||||
iconLabel = new JLabel(GuiUtils.getEmptyIcon(40, 40));
|
||||
} else {
|
||||
iconLabel = new JLabel(GuiUtils.getResizedIcon(icon, 40, 40));
|
||||
}
|
||||
|
||||
iconLabel.setBorder(new LineBorder(Color.BLACK));
|
||||
iconLabel.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||
|
||||
final JPanel iconPanel = new JPanel(new BorderLayout());
|
||||
iconPanel.setOpaque(false);
|
||||
iconPanel.add(iconLabel, BorderLayout.NORTH);
|
||||
this.add(iconPanel, BorderLayout.WEST);
|
||||
|
||||
this.getRootPanel().setOpaque(false);
|
||||
this.getRootPanel().setLayout(new BoxLayout(this.getRootPanel(), BoxLayout.Y_AXIS));
|
||||
this.add(this.getRootPanel(), BorderLayout.CENTER);
|
||||
|
||||
final JPanel centerTopPanel = new JPanel();
|
||||
centerTopPanel.setOpaque(false);
|
||||
centerTopPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
centerTopPanel.setLayout(new BoxLayout(centerTopPanel, BoxLayout.X_AXIS));
|
||||
|
||||
final JLabel nameLabel = new JLabel(qe.getTitle());
|
||||
GuiUtils.setFontSize(nameLabel, 20);
|
||||
nameLabel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
|
||||
centerTopPanel.add(nameLabel);
|
||||
|
||||
GuiUtils.addExpandingHorizontalSpace(centerTopPanel);
|
||||
|
||||
final JLabel difficultyLabel = new JLabel(qe.getDifficulty());
|
||||
difficultyLabel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
|
||||
centerTopPanel.add(difficultyLabel);
|
||||
this.getRootPanel().add(centerTopPanel);
|
||||
|
||||
GuiUtils.addGap(this.getRootPanel());
|
||||
|
||||
final JLabel descriptionLabel = new JLabel(qe.getDescription());
|
||||
descriptionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
this.getRootPanel().add(descriptionLabel);
|
||||
|
||||
this.setMaximumSize(new Dimension(Integer.MAX_VALUE, 80));
|
||||
this.setBorder(new CompoundBorder(new LineBorder(Color.BLACK), new EmptyBorder(5, 5, 5, 5)));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* isSelected.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean isSelected() {
|
||||
return this.selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Setter for the field <code>selected</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param selected
|
||||
* a boolean.
|
||||
*/
|
||||
public final void setSelected(final boolean selected) {
|
||||
if (selected) {
|
||||
this.setBackground(this.backgroundColor.darker());
|
||||
} else {
|
||||
this.setBackground(this.backgroundColor);
|
||||
}
|
||||
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getIconFilename.
|
||||
* </p>
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public final String getIconFilename() {
|
||||
return this.iconfilename;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getEvent.
|
||||
* </p>
|
||||
*
|
||||
* @return QuestEvent
|
||||
*/
|
||||
public final QuestEvent getEvent() {
|
||||
return this.event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root panel.
|
||||
*
|
||||
* @return the rootPanel
|
||||
*/
|
||||
public JPanel getRootPanel() {
|
||||
return this.rootPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the root panel.
|
||||
*
|
||||
* @param rootPanel0
|
||||
* the rootPanel to set
|
||||
*/
|
||||
public void setRootPanel(final JPanel rootPanel0) {
|
||||
this.rootPanel = rootPanel0;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
/** Forge Card Game. */
|
||||
package forge.quest.gui.main;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
/** Forge Card Game. */
|
||||
package forge.quest.gui;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui;
|
||||
package forge.view.match;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.quest.gui;
|
||||
package forge.view.match;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
@@ -54,7 +54,6 @@ import forge.quest.data.QuestPreferences.QPref;
|
||||
import forge.quest.data.QuestUtil;
|
||||
import forge.util.MyRandom;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.match.ViewWinLose;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
@@ -19,7 +19,6 @@ import forge.game.GameType;
|
||||
import forge.model.FMatchState;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants.Lang.GuiWinLose.WinLoseText;
|
||||
import forge.quest.gui.QuestWinLoseHandler;
|
||||
import forge.view.toolbox.FButton;
|
||||
import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package forge;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import forge.quest.gui.QuestOptions;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA. User: dhudson
|
||||
*/
|
||||
@Test(groups = { "UnitTest" }, enabled = false)
|
||||
public class GuiQuestOptionsTest {
|
||||
|
||||
/**
|
||||
* Gui quest options test1.
|
||||
*/
|
||||
@Test(groups = { "UnitTest", "fast" }, enabled = false)
|
||||
public void guiQuestOptionsTest1() {
|
||||
final QuestOptions dialog = new QuestOptions();
|
||||
dialog.setVisible(true);
|
||||
Assert.assertNotNull(dialog);
|
||||
dialog.dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user