diff --git a/res/pics/icons/PetIcon.png b/res/pics/icons/PetIcon.png index 21b9dc15597..38ed9632ddf 100644 Binary files a/res/pics/icons/PetIcon.png and b/res/pics/icons/PetIcon.png differ diff --git a/res/pics/icons/PlantIcon.png b/res/pics/icons/PlantIcon.png index e2e243848fd..dae1d86ba1b 100644 Binary files a/res/pics/icons/PlantIcon.png and b/res/pics/icons/PlantIcon.png differ diff --git a/src/main/java/forge/control/ControlAllUI.java b/src/main/java/forge/control/ControlAllUI.java index ad7b233cd36..b323082eab7 100644 --- a/src/main/java/forge/control/ControlAllUI.java +++ b/src/main/java/forge/control/ControlAllUI.java @@ -24,8 +24,8 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JLayeredPane; +import javax.swing.WindowConstants; -import forge.AllZone; import forge.quest.gui.bazaar.QuestBazaarPanel; import forge.view.GuiTopLevel; import forge.view.editor.EditorTopLevel; @@ -46,7 +46,7 @@ public class ControlAllUI { private HomeTopLevel home = null; private ViewTopLevel match = null; private EditorTopLevel editor = null; - private WindowAdapter waConcede; + private WindowAdapter waDefault, waConcede, waLeaveBazaar; private QuestBazaarPanel bazaar; /** */ @@ -73,13 +73,38 @@ public class ControlAllUI { this.display = (JLayeredPane) this.view.getContentPane(); + // "Close" button override during match this.waConcede = new WindowAdapter() { @Override - public void windowClosing(final WindowEvent evt) { - ViewTopLevel t = ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView(); - t.getDockController().concede(); + public void windowClosing(final WindowEvent e) { + view.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + getMatchView().getDockController().concede(); } }; + + // "Close" button override while inside bazaar (will probably be used later for other things) + this.waLeaveBazaar = new WindowAdapter() { + @Override + public void windowClosing(final WindowEvent e) { + view.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + changeState(0); + } + }; + + // Default action on window close + this.waDefault = new WindowAdapter() { + public void windowClosing(WindowEvent e) { + view.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } + }; + + // Handles resizing in null layouts of layers in JLayeredPane. + view.addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(final ComponentEvent e) { + sizeChildren(); + } + }); } /** @@ -98,15 +123,10 @@ public class ControlAllUI { this.display.removeAll(); this.view.removeWindowListener(waConcede); + this.view.removeWindowListener(waLeaveBazaar); + this.view.addWindowListener(waDefault); this.view.addOverlay(); - view.addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(final ComponentEvent e) { - sizeChildren(); - } - }); - // Fire up new state switch (i) { case 0: // Home screen @@ -131,6 +151,7 @@ public class ControlAllUI { this.bazaar = new QuestBazaarPanel(null); this.display.add(bazaar, JLayeredPane.DEFAULT_LAYER); sizeChildren(); + view.addWindowListener(waLeaveBazaar); break; default: @@ -171,7 +192,7 @@ public class ControlAllUI { } /** Sizes children of JLayeredPane to fully fit their layers. */ - private void sizeChildren() { + private void sizeChildren() { System.out.println("asdf55"); Component[] children; children = ControlAllUI.this.display.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER); diff --git a/src/main/java/forge/control/home/ControlQuest.java b/src/main/java/forge/control/home/ControlQuest.java index ba7c37e34b6..b8757000b50 100644 --- a/src/main/java/forge/control/home/ControlQuest.java +++ b/src/main/java/forge/control/home/ControlQuest.java @@ -91,6 +91,14 @@ public class ControlQuest { g.setVisible(true); } + private void updateCredits() { + view.getLblCredits().setText(Long.toString(view.getQuestData().getCredits())); + } + + private void updateLife() { + view.getLblLife().setText(Long.toString(view.getQuestData().getLife())); + } + /** */ public void showCardShop() { final Command exit = new Command() { @@ -100,6 +108,8 @@ public class ControlQuest { public void execute() { // saves all deck data AllZone.getQuestData().saveData(); + updateCredits(); + updateLife(); } }; diff --git a/src/main/java/forge/view/home/ViewQuest.java b/src/main/java/forge/view/home/ViewQuest.java index f534bfdcf00..497719cfc29 100644 --- a/src/main/java/forge/view/home/ViewQuest.java +++ b/src/main/java/forge/view/home/ViewQuest.java @@ -56,7 +56,7 @@ public class ViewQuest extends JScrollPane { private JRadioButton radEasy, radMedium, radHard, radExpert, radFantasy, radClassic; private JCheckBox cbStandardStart, cbPlant, cbZep; private JComboBox cbxPet; - private JLabel lblPlant, lblPet, lblZep; + private JLabel lblPlant, lblPet, lblZep, lblLife, lblCredits; private boolean previousQuestExists = false; /** @@ -69,6 +69,7 @@ public class ViewQuest extends JScrollPane { super(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED); this.setOpaque(false); this.setBorder(null); + this.getVerticalScrollBar().setUnitIncrement(16); parentView = v0; skin = AllZone.getSkin(); @@ -192,14 +193,14 @@ public class ViewQuest extends JScrollPane { optionsContainer.setLayout(new MigLayout("insets 0, gap 0")); optionsContainer.setBorder(new MatteBorder(0, 0, 1, 0, skin.getColor("borders"))); - JLabel lblCredits = new JLabel("Credits: " + Long.toString(questData.getCredits())); + lblCredits = new JLabel("Credits: " + Long.toString(questData.getCredits())); lblCredits.setIcon(GuiUtils.getResizedIcon(new ImageIcon("res/pics/icons/CoinStack.png"), 26, 26)); lblCredits.setForeground(skin.getColor("text")); lblCredits.setIconTextGap(5); lblCredits.setHorizontalAlignment(SwingConstants.CENTER); lblCredits.setFont(skin.getFont1().deriveFont(Font.BOLD, 14)); - JLabel lblLife = new JLabel("Life: " + Long.toString(questData.getLife())); + lblLife = new JLabel("Life: " + Long.toString(questData.getLife())); lblLife.setIcon(GuiUtils.getResizedIcon(new ImageIcon("res/pics/icons/Life.png"), 26, 26)); lblLife.setForeground(skin.getColor("text")); lblLife.setIconTextGap(5); @@ -260,8 +261,10 @@ public class ViewQuest extends JScrollPane { cbxPet = new JComboBox(); cbxPet.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14)); - cbPlant = new OptionsCheckBox("Summon Wall"); + cbPlant = new OptionsCheckBox("Summon Plant"); + cbPlant.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14)); cbZep = new OptionsCheckBox("Launch Zeppelin"); + cbZep.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14)); lblPet = new JLabel(GuiUtils.getResizedIcon( new ImageIcon("res/pics/icons/PetIcon.png"), 30, 30)); @@ -637,4 +640,14 @@ public class ViewQuest extends JScrollPane { public boolean hasPreviousQuest() { return previousQuestExists; } + + /** @return JLabel */ + public JLabel getLblLife() { + return lblLife; + } + + /** @return JLabel */ + public JLabel getLblCredits() { + return lblCredits; + } }