GUI - remove anything that was checking the unused Constant.Runtime.OLDGUI

This commit is contained in:
slapshot5
2012-01-06 03:31:24 +00:00
parent 7d87f62ac7
commit 3f02b7761d
18 changed files with 31 additions and 166 deletions

View File

@@ -68,9 +68,6 @@ public final class Constant {
/** The Constant LIBRARYVIEW. */ /** The Constant LIBRARYVIEW. */
public static final boolean[] LIBRARYVIEW = new boolean[1]; public static final boolean[] LIBRARYVIEW = new boolean[1];
/** The Constant OLDGUI. */
public static final boolean[] OLDGUI = new boolean[1];
/** The Constant NetConn. */ /** The Constant NetConn. */
public static final boolean[] NET_CONN = new boolean[1]; public static final boolean[] NET_CONN = new boolean[1];

View File

@@ -536,10 +536,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
AllZone.getGameLog().add("Turn", "Turn " + turn + " (" + getPlayerTurn() + ")", 0); AllZone.getGameLog().add("Turn", "Turn " + turn + " (" + getPlayerTurn() + ")", 0);
} }
// Visual indicators PhaseUtil.visuallyActivatePhase(this.getPhase());
if (!Constant.Runtime.OLDGUI[0]) {
PhaseUtil.visuallyActivatePhase(this.getPhase());
}
// When consecutively skipping phases (like in combat) this section // When consecutively skipping phases (like in combat) this section
// pushes through that block // pushes through that block

View File

@@ -31,8 +31,6 @@ import forge.gui.GuiUtils;
import forge.item.CardDb; import forge.item.CardDb;
import forge.item.CardPrinted; import forge.item.CardPrinted;
import forge.view.GuiTopLevel; import forge.view.GuiTopLevel;
import forge.view.swing.GuiHomeScreen;
import forge.view.swing.OldGuiNewGame;
import forge.view.toolbox.WinLoseFrame; import forge.view.toolbox.WinLoseFrame;
/** /**
@@ -70,20 +68,7 @@ public class ControlWinLose {
* *
*/ */
public void actionOnQuit() { public void actionOnQuit() {
if (System.getenv("NG2") != null) { ((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
if (System.getenv("NG2").equalsIgnoreCase("true")) {
final String[] argz = {};
GuiHomeScreen.main(argz);
} else {
new OldGuiNewGame();
}
} else {
if (Constant.Runtime.OLDGUI[0]) {
new OldGuiNewGame();
} else {
((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
}
}
} }
/** /**

View File

@@ -97,7 +97,7 @@ public class ControlDraft {
Constant.Runtime.COMPUTER_DECK[0] = opponentDecks[aiIndex]; Constant.Runtime.COMPUTER_DECK[0] = opponentDecks[aiIndex];
if (Constant.Runtime.COMPUTER_DECK[0] == null) { if (Constant.Runtime.COMPUTER_DECK[0] == null) {
throw new IllegalStateException("OldGuiNewGame : startButton() error - computer deck is null"); throw new IllegalStateException("startButton() error - computer deck is null");
} }
GuiTopLevel g = (GuiTopLevel) AllZone.getDisplay(); GuiTopLevel g = (GuiTopLevel) AllZone.getDisplay();

View File

@@ -54,7 +54,6 @@ import forge.item.ItemPoolView;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
import forge.properties.NewConstants.Lang.GuiBoosterDraft; import forge.properties.NewConstants.Lang.GuiBoosterDraft;
import forge.view.GuiTopLevel; import forge.view.GuiTopLevel;
import forge.view.swing.OldGuiNewGame;
/** /**
* <p> * <p>
@@ -136,14 +135,8 @@ public class DeckEditorDraft extends DeckEditorBase {
ForgeProps.getLocalized(GuiBoosterDraft.CLOSE_MESSAGE), "", JOptionPane.YES_NO_OPTION); ForgeProps.getLocalized(GuiBoosterDraft.CLOSE_MESSAGE), "", JOptionPane.YES_NO_OPTION);
if (n == JOptionPane.YES_OPTION) { if (n == JOptionPane.YES_OPTION) {
DeckEditorDraft.this.dispose(); DeckEditorDraft.this.dispose();
ControlAllUI g = ((GuiTopLevel) AllZone.getDisplay()).getController();
if (Constant.Runtime.OLDGUI[0]) { g.getHomeView().getDraftController().updateHumanDecks();
new OldGuiNewGame();
}
else {
ControlAllUI g = ((GuiTopLevel) AllZone.getDisplay()).getController();
g.getHomeView().getDraftController().updateHumanDecks();
}
} }
} // windowClosing() } // windowClosing()
}); });
@@ -362,13 +355,8 @@ public class DeckEditorDraft extends DeckEditorBase {
// close and open next screen // close and open next screen
this.dispose(); this.dispose();
if (Constant.Runtime.OLDGUI[0]) { ControlAllUI g = ((GuiTopLevel) AllZone.getDisplay()).getController();
new OldGuiNewGame(); g.getHomeView().getDraftController().updateHumanDecks();
}
else {
ControlAllUI g = ((GuiTopLevel) AllZone.getDisplay()).getController();
g.getHomeView().getDraftController().updateHumanDecks();
}
} /* saveDraft() */ } /* saveDraft() */

View File

@@ -104,15 +104,9 @@ public class InputAttack extends Input {
// return; // return;
AllZone.getCombat().addAttacker(card); AllZone.getCombat().addAttacker(card);
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers(); // just
// to // just to make sure the attack symbol is marked
// make AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers();
// sure
// the
// attack
// symbol
// is
// marked
// for Castle Raptors, since it gets a bonus if untapped // for Castle Raptors, since it gets a bonus if untapped
for (final String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) { for (final String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
@@ -122,7 +116,7 @@ public class InputAttack extends Input {
CombatUtil.showCombat(); CombatUtil.showCombat();
} }
else if (!Constant.Runtime.OLDGUI[0]) { else {
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind(); ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
} }
} // selectCard() } // selectCard()

View File

@@ -111,7 +111,7 @@ public class InputBlock extends Input {
AllZone.getCombat().addBlocker(this.currentAttacker, card); AllZone.getCombat().addBlocker(this.currentAttacker, card);
} }
} }
else if (!Constant.Runtime.OLDGUI[0]) { else {
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind(); ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
} }
this.showMessage(); this.showMessage();

View File

@@ -221,7 +221,7 @@ public class InputMulligan extends Input {
} }
c0.getController().drawCards(hand.size()); c0.getController().drawCards(hand.size());
} }
} else if (!Constant.Runtime.OLDGUI[0]) { } else {
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind(); ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
} }
} }

View File

@@ -20,7 +20,6 @@ package forge.gui.input;
import forge.AllZone; import forge.AllZone;
import forge.ButtonUtil; import forge.ButtonUtil;
import forge.Card; import forge.Card;
import forge.Constant;
import forge.GuiDisplayUtil; import forge.GuiDisplayUtil;
import forge.Player; import forge.Player;
import forge.PlayerZone; import forge.PlayerZone;
@@ -85,7 +84,7 @@ public class InputPassPriority extends Input implements java.io.Serializable {
if (AllZone.getGameAction().playCard(card)) { if (AllZone.getGameAction().playCard(card)) {
AllZone.getPhase().setPriority(AllZone.getHumanPlayer()); AllZone.getPhase().setPriority(AllZone.getHumanPlayer());
} }
else if (!Constant.Runtime.OLDGUI[0]) { else {
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind(); ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
} }
} // selectCard() } // selectCard()

View File

@@ -806,9 +806,6 @@ public final class NewConstants {
/** The DECK_EDITOR. */ /** The DECK_EDITOR. */
public static final String DECK_EDITOR = "%s/NewGame/deckeditor"; public static final String DECK_EDITOR = "%s/NewGame/deckeditor";
/** The OLD_GUI. */
public static final String OLD_GUI = "%s/NewGame/oldgui";
/** The AI_LAND. */ /** The AI_LAND. */
public static final String AI_LAND = "%s/NewGame/ailand"; public static final String AI_LAND = "%s/NewGame/ailand";

View File

@@ -31,7 +31,6 @@ import javax.swing.border.EmptyBorder;
import forge.AllZone; import forge.AllZone;
import forge.gui.GuiUtils; import forge.gui.GuiUtils;
import forge.quest.gui.bazaar.QuestBazaarPanel; import forge.quest.gui.bazaar.QuestBazaarPanel;
import forge.view.swing.GuiHomeScreen;
import forge.view.swing.OldGuiNewGame; import forge.view.swing.OldGuiNewGame;
/** /**
@@ -138,17 +137,7 @@ public class QuestFrame extends JFrame {
*/ */
public final void returnToMainMenu() { public final void returnToMainMenu() {
AllZone.getQuestData().saveData(); AllZone.getQuestData().saveData();
new OldGuiNewGame();
if (System.getenv("NG2") != null) {
if (System.getenv("NG2").equalsIgnoreCase("true")) {
final String[] argz = {};
GuiHomeScreen.main(argz);
} else {
new OldGuiNewGame();
}
} else {
new OldGuiNewGame();
}
this.dispose(); this.dispose();
} }

View File

@@ -46,7 +46,6 @@ import javax.swing.border.TitledBorder;
import forge.AllZone; import forge.AllZone;
import forge.Command; import forge.Command;
import forge.Constant; import forge.Constant;
import forge.GuiDisplay;
import forge.ImageCache; import forge.ImageCache;
import forge.deck.Deck; import forge.deck.Deck;
import forge.gui.GuiUtils; import forge.gui.GuiUtils;
@@ -771,16 +770,10 @@ public class QuestMainPanel extends QuestAbstractPanel {
Constant.Quest.OPP_ICON_NAME[0] = this.getEventIconFilename(); Constant.Quest.OPP_ICON_NAME[0] = this.getEventIconFilename();
// Dev Mode occurs before Display
Constant.Runtime.DEV_MODE[0] = this.devModeCheckBox.isSelected();
if (Constant.Runtime.OLDGUI[0]) { GuiTopLevel g = (GuiTopLevel) AllZone.getDisplay();
AllZone.setDisplay(new GuiDisplay()); g.getController().changeState(1);
} else { g.getController().getMatchController().initMatch();
GuiTopLevel g = (GuiTopLevel) AllZone.getDisplay();
g.getController().changeState(1);
g.getController().getMatchController().initMatch();
}
Constant.Runtime.SMOOTH[0] = this.smoothLandCheckBox.isSelected(); Constant.Runtime.SMOOTH[0] = this.smoothLandCheckBox.isSelected();

View File

@@ -44,7 +44,6 @@ import forge.gui.GuiUtils;
import forge.quest.data.QuestData; import forge.quest.data.QuestData;
import forge.quest.data.QuestDataIO; import forge.quest.data.QuestDataIO;
import forge.quest.data.QuestPreferences; import forge.quest.data.QuestPreferences;
import forge.view.swing.GuiHomeScreen;
import forge.view.swing.OldGuiNewGame; import forge.view.swing.OldGuiNewGame;
/** /**
@@ -118,17 +117,7 @@ public class QuestOptions extends JFrame {
public void windowClosing(final WindowEvent ev) { public void windowClosing(final WindowEvent ev) {
QuestOptions.this.dispose(); QuestOptions.this.dispose();
if (System.getenv("NG2") != null) { new OldGuiNewGame();
if (System.getenv("NG2").equalsIgnoreCase("true")) {
final String[] argz = {};
GuiHomeScreen.main(argz);
} else {
new OldGuiNewGame();
}
} else {
new OldGuiNewGame();
}
} }
}); });

View File

@@ -301,13 +301,8 @@ public class QuestWinLoseHandler extends ControlWinLose {
this.model.qData.saveData(); this.model.qData.saveData();
if (Constant.Runtime.OLDGUI[0]) { ((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
new QuestFrame(); ((GuiTopLevel) AllZone.getDisplay()).getController().getHomeView().showQuestMenu();
}
else {
((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
((GuiTopLevel) AllZone.getDisplay()).getController().getHomeView().showQuestMenu();
}
} }
/** /**

View File

@@ -32,7 +32,6 @@ import javax.swing.JPanel;
import javax.swing.JToggleButton; import javax.swing.JToggleButton;
import forge.AllZone; import forge.AllZone;
import forge.Constant;
import forge.control.ControlAllUI; import forge.control.ControlAllUI;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.quest.gui.QuestAbstractPanel; import forge.quest.gui.QuestAbstractPanel;
@@ -146,14 +145,9 @@ public class QuestBazaarPanel extends QuestAbstractPanel {
quitButton.addActionListener(new ActionListener() { quitButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(final ActionEvent e) { public void actionPerformed(final ActionEvent e) {
if (Constant.Runtime.OLDGUI[0]) { ControlAllUI g = ((GuiTopLevel) AllZone.getDisplay()).getController();
QuestBazaarPanel.this.getMainFrame().showMainPane(); g.changeState(ControlAllUI.HOME_SCREEN);
} g.getHomeView().showQuestMenu();
else {
ControlAllUI g = ((GuiTopLevel) AllZone.getDisplay()).getController();
g.changeState(ControlAllUI.HOME_SCREEN);
g.getHomeView().showQuestMenu();
}
} }
}); });

View File

@@ -163,15 +163,10 @@ public class ApplicationView implements FView {
ApplicationView.this.splashFrame = null; ApplicationView.this.splashFrame = null;
if (!Constant.Runtime.OLDGUI[0]) { GuiTopLevel g = new GuiTopLevel();
GuiTopLevel g = new GuiTopLevel(); g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); AllZone.setDisplay(g);
AllZone.setDisplay(g); g.getController().changeState(ControlAllUI.HOME_SCREEN);
g.getController().changeState(ControlAllUI.HOME_SCREEN);
}
else {
new OldGuiNewGame();
}
} }
}); });
} catch (final Exception ex) { } catch (final Exception ex) {

View File

@@ -62,7 +62,6 @@ import forge.Command;
import forge.Constant; import forge.Constant;
import forge.ConstantStringArrayList; import forge.ConstantStringArrayList;
import forge.FileUtil; import forge.FileUtil;
import forge.GuiDisplay;
import forge.GuiDownloadPicturesLQ; import forge.GuiDownloadPicturesLQ;
import forge.GuiDownloadPrices; import forge.GuiDownloadPrices;
import forge.GuiDownloadQuestImages; import forge.GuiDownloadQuestImages;
@@ -138,8 +137,6 @@ public class OldGuiNewGame extends JFrame {
// @SuppressWarnings("unused") // @SuppressWarnings("unused")
// titledBorder2 // titledBorder2
/** Constant <code>oldGuiCheckBox</code>. */
private static JCheckBox oldGuiCheckBox = new JCheckBox("", false);
/** Constant <code>smoothLandCheckBox</code>. */ /** Constant <code>smoothLandCheckBox</code>. */
private static JCheckBox smoothLandCheckBox = new JCheckBox("", false); private static JCheckBox smoothLandCheckBox = new JCheckBox("", false);
/** Constant <code>devModeCheckBox</code>. */ /** Constant <code>devModeCheckBox</code>. */
@@ -563,15 +560,6 @@ public class OldGuiNewGame extends JFrame {
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SETTINGS)); ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.SETTINGS));
this.jPanel3.setLayout(new MigLayout("align center")); this.jPanel3.setLayout(new MigLayout("align center"));
OldGuiNewGame.oldGuiCheckBox.setText(ForgeProps
.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.OLD_GUI));
OldGuiNewGame.oldGuiCheckBox.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Constant.Runtime.OLDGUI[0] = OldGuiNewGame.oldGuiCheckBox.isSelected();
}
});
OldGuiNewGame.getSmoothLandCheckBox().setText( OldGuiNewGame.getSmoothLandCheckBox().setText(
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.AI_LAND)); ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.NewGameText.AI_LAND));
@@ -654,7 +642,6 @@ public class OldGuiNewGame extends JFrame {
this.getContentPane().add(this.jPanel3, "span 2, grow"); this.getContentPane().add(this.jPanel3, "span 2, grow");
this.jPanel3.add(OldGuiNewGame.oldGuiCheckBox, "wrap");
this.jPanel3.add(OldGuiNewGame.getSmoothLandCheckBox(), "wrap"); this.jPanel3.add(OldGuiNewGame.getSmoothLandCheckBox(), "wrap");
this.jPanel3.add(OldGuiNewGame.getDevModeCheckBox(), "wrap"); this.jPanel3.add(OldGuiNewGame.getDevModeCheckBox(), "wrap");
this.jPanel3.add(OldGuiNewGame.getUpldDrftCheckBox(), "wrap"); this.jPanel3.add(OldGuiNewGame.getUpldDrftCheckBox(), "wrap");
@@ -880,18 +867,9 @@ public class OldGuiNewGame extends JFrame {
} }
} // else } // else
// Update old gui checkbox for first run ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().initMatch();
Constant.Runtime.OLDGUI[0] = OldGuiNewGame.oldGuiCheckBox.isSelected();
if (Constant.Runtime.OLDGUI[0]) {
AllZone.setDisplay(new GuiDisplay());
} else {
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().initMatch();
}
Constant.Runtime.SMOOTH[0] = OldGuiNewGame.getSmoothLandCheckBox().isSelected(); Constant.Runtime.SMOOTH[0] = OldGuiNewGame.getSmoothLandCheckBox().isSelected();
// Constant.Runtime.DEV_MODE[0] =
// OldGuiNewGame.devModeCheckBox.isSelected();
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]); AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
AllZone.getDisplay().setVisible(true); AllZone.getDisplay().setVisible(true);
@@ -1910,13 +1888,4 @@ public class OldGuiNewGame extends JFrame {
public static void setFoilRandomCheckBox(final JCheckBox foilRandomCheckBox0) { public static void setFoilRandomCheckBox(final JCheckBox foilRandomCheckBox0) {
OldGuiNewGame.foilRandomCheckBox = foilRandomCheckBox0; OldGuiNewGame.foilRandomCheckBox = foilRandomCheckBox0;
} }
/**
* Gets the old gui check box.
*
* @return JCheckBox
*/
public static JCheckBox getOldGuiCheckBox() {
return OldGuiNewGame.oldGuiCheckBox;
}
} }

View File

@@ -35,7 +35,6 @@ import javax.swing.border.AbstractBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Constant;
import forge.Phase; import forge.Phase;
import forge.Player; import forge.Player;
import forge.control.ControlWinLose; import forge.control.ControlWinLose;
@@ -244,10 +243,7 @@ public class WinLoseFrame extends JFrame {
final void btnContinueActionPerformed(final ActionEvent e) { final void btnContinueActionPerformed(final ActionEvent e) {
this.closeWinLoseFrame(); this.closeWinLoseFrame();
// Instantiate a new ControlAllUI if using new UI. ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().initMatch();
if (!Constant.Runtime.OLDGUI[0]) {
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().initMatch();
}
AllZone.getDisplay().setVisible(true); AllZone.getDisplay().setVisible(true);
this.modeHandler.startNextRound(); this.modeHandler.startNextRound();
@@ -264,10 +260,7 @@ public class WinLoseFrame extends JFrame {
final void btnRestartActionPerformed(final ActionEvent e) { final void btnRestartActionPerformed(final ActionEvent e) {
this.closeWinLoseFrame(); this.closeWinLoseFrame();
// Instantiate a new ControlAllUI if using new UI. ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().initMatch();
if (!Constant.Runtime.OLDGUI[0]) {
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().initMatch();
}
AllZone.getDisplay().setVisible(true); AllZone.getDisplay().setVisible(true);
this.matchState.reset(); this.matchState.reset();
@@ -302,15 +295,6 @@ public class WinLoseFrame extends JFrame {
* @return {@link javax.swing.JFrame} display frame * @return {@link javax.swing.JFrame} display frame
*/ */
private void closeWinLoseFrame() { private void closeWinLoseFrame() {
JFrame frame;
// Issue 147 - keep battlefield up following win/loss
if (Constant.Runtime.OLDGUI[0]) {
frame = (JFrame) AllZone.getDisplay();
frame.dispose();
frame.setEnabled(true);
}
this.dispose(); this.dispose();
} }