mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Bugfix: "Double-click for decklist" crash on random generated decks (colors and themes).
- Further standardized messages and font sizes. - A little checkstyle.
This commit is contained in:
@@ -72,7 +72,11 @@ public enum CSubmenuGauntletBuild implements ICDoc {
|
||||
private final MouseAdapter madDecklist = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
if (e.getClickCount() == 2) { GauntletDeckUtil.showDecklist(((JList) e.getSource())); }
|
||||
if (e.getClickCount() == 2) {
|
||||
if (view.getRadColorDecks().isSelected()) { return; }
|
||||
if (view.getRadThemeDecks().isSelected()) { return; }
|
||||
|
||||
GauntletDeckUtil.showDecklist(((JList) e.getSource())); }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ public enum CSubmenuGauntletQuick implements ICDoc {
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
if (e.getClickCount() == 2) {
|
||||
if (view.getRadColorDecks().isSelected()) { return; }
|
||||
if (view.getRadThemeDecks().isSelected()) { return; }
|
||||
|
||||
GauntletDeckUtil.showDecklist(((JList) e.getSource())); }
|
||||
}
|
||||
};
|
||||
@@ -295,7 +298,7 @@ public enum CSubmenuGauntletQuick implements ICDoc {
|
||||
Deck human = gd.getUserDeck();
|
||||
Deck aiDeck = gd.getDecks().get(gd.getCompleted());
|
||||
if (human != null && aiDeck != null) {
|
||||
GameNew.newGame(new PlayerStartsGame( AllZone.getHumanPlayer(), human),
|
||||
GameNew.newGame(new PlayerStartsGame(AllZone.getHumanPlayer(), human),
|
||||
new PlayerStartsGame(AllZone.getComputerPlayer(), aiDeck));
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -26,7 +26,6 @@ import forge.gui.toolbox.FList;
|
||||
import forge.gui.toolbox.FRadioButton;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FTextArea;
|
||||
import forge.gui.toolbox.FTextField;
|
||||
|
||||
/**
|
||||
@@ -70,11 +69,17 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
||||
|
||||
private final JTextField txfFilename = new FTextField();
|
||||
|
||||
private final FTextArea tarDesc1 = new FTextArea(
|
||||
"Use the left or right arrows to add or remove decks from the gauntlet.");
|
||||
private final FLabel lblDesc1 = new FLabel.Builder()
|
||||
.text("Left/right arrows add or remove decks.")
|
||||
.fontSize(12).build();
|
||||
|
||||
private final FTextArea tarDesc2 = new FTextArea(
|
||||
"Change the order of the opponents by using the up and down arrows.");
|
||||
private final FLabel lblDesc2 = new FLabel.Builder()
|
||||
.text("Up/down arrows change opponent order.")
|
||||
.fontSize(12).build();
|
||||
|
||||
private final FLabel lblDecklist = new FLabel.Builder()
|
||||
.text("Double click a non-random deck for its decklist.")
|
||||
.fontSize(12).build();
|
||||
|
||||
private final JLabel lblSave = new FLabel.Builder().text("Changes not yet saved.")
|
||||
.build();
|
||||
@@ -123,8 +128,6 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
||||
.icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_OPEN))
|
||||
.text(" ").hoverable(true).build();
|
||||
|
||||
private final JTextField txfSearch = new FTextField();
|
||||
|
||||
private VSubmenuGauntletBuild() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
@@ -155,37 +158,25 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
||||
pnlFileHandling.add(btnNew, "h 30px!, w 30px!, gap 0 5px 0 0");
|
||||
pnlFileHandling.add(btnOpen, "h 30px!, w 30px!, gap 0 5px 0 0");
|
||||
|
||||
// Radio button panel
|
||||
txfSearch.setText("Search");
|
||||
txfSearch.setMargin(new Insets(5, 5, 5, 5));
|
||||
txfSearch.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
txfSearch.setOpaque(true);
|
||||
txfSearch.setEditable(true);
|
||||
txfSearch.setFocusable(true);
|
||||
txfSearch.setOpaque(true);
|
||||
txfSearch.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
// Radios panel
|
||||
pnlRadios.setOpaque(false);
|
||||
pnlRadios.add(radUserDecks, "h 30px!, gap 0 0 0 5px");
|
||||
pnlRadios.add(radQuestDecks, "h 30px!, gap 0 0 0 5px");
|
||||
pnlRadios.add(radColorDecks, "h 30px!, gap 0 0 0 5px");
|
||||
pnlRadios.add(radThemeDecks, "h 30px!, gap 0 0 0 5px");
|
||||
//pnlRadios.add(txfSearch, "h 30px!, w 100%!, gap 0 0 0 5px");
|
||||
|
||||
// Directions panel
|
||||
final JPanel pnlSpacer = new JPanel();
|
||||
pnlSpacer.setOpaque(false);
|
||||
tarDesc1.setFont(FSkin.getFont(14));
|
||||
tarDesc2.setFont(FSkin.getFont(14));
|
||||
|
||||
pnlStrut.setOpaque(false);
|
||||
lblSave.setForeground(Color.red);
|
||||
lblSave.setVisible(false);
|
||||
pnlDirections.setOpaque(false);
|
||||
pnlDirections.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||
pnlDirections.add(pnlSpacer, "pushy, growy");
|
||||
pnlDirections.add(tarDesc1, "w 98%!, gap 1% 0 0 10px");
|
||||
pnlDirections.add(tarDesc2, "w 98%!, gap 1% 0 0 20px");
|
||||
pnlDirections.add(pnlSpacer, "w 100%!, pushy, growy");
|
||||
pnlDirections.add(lblDesc1, "gap 1% 0 0 10px");
|
||||
pnlDirections.add(lblDesc2, "gap 1% 0 0 10px");
|
||||
pnlDirections.add(lblDecklist, "gap 1% 0 0 20px");
|
||||
pnlDirections.add(lblSave, "ax center, gap 0 0 0 5px");
|
||||
|
||||
// Deck movement panel
|
||||
@@ -234,9 +225,9 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
||||
parentCell.getBody().add(pnlStrut, "w 40px!, gap 1% 1% 0 15px");
|
||||
parentCell.getBody().add(pnlDirections, "w 48% - 20px!, gap 0 0 0 15px");
|
||||
|
||||
parentCell.getBody().add(scrLeft, "w 48% - 20px!, gap 1% 0 0 15px, pushy, growy");
|
||||
parentCell.getBody().add(pnlButtons, "w 40px!, gap 1% 1% 0 15px, pushy, growy");
|
||||
parentCell.getBody().add(scrRight, "w 48% - 20px!, gap 0 0 0 15px, pushy, growy");
|
||||
parentCell.getBody().add(scrLeft, "w 48% - 20px!, gap 1% 0 0 25px, pushy, growy");
|
||||
parentCell.getBody().add(pnlButtons, "w 40px!, gap 1% 1% 0 25px, pushy, growy");
|
||||
parentCell.getBody().add(scrRight, "w 48% - 20px!, gap 0 0 0 25px, pushy, growy");
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JList} */
|
||||
@@ -309,11 +300,6 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
||||
return lblSave;
|
||||
}
|
||||
|
||||
/** @return {@link forge.gui.toolbox.FLabel} */
|
||||
public JTextField getTxfSearch() {
|
||||
return this.txfSearch;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JTextField} */
|
||||
public JTextField getTxfFilename() {
|
||||
return txfFilename;
|
||||
|
||||
@@ -50,6 +50,10 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
||||
.text("Quick Gauntlet Builder").fontAlign(SwingConstants.CENTER)
|
||||
.opaque(true).fontSize(16).build();
|
||||
|
||||
private final FLabel lblDecklist = new FLabel.Builder()
|
||||
.text("Double click a non-random deck for its decklist.")
|
||||
.fontSize(12).build();
|
||||
|
||||
private JSlider sliOpponents = new JSlider(JSlider.HORIZONTAL, 5, 50, 20);
|
||||
//private JSlider sliGamesPerMatch = new JSlider(JSlider.HORIZONTAL, 1, 7, 3);
|
||||
|
||||
@@ -88,7 +92,7 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
||||
|
||||
private final JLabel lblDesc = new FLabel.Builder().text(
|
||||
"A new quick gauntlet is auto-saved. They can be loaded in the \"Load Gauntlet\" screen.")
|
||||
.build();
|
||||
.fontSize(12).build();
|
||||
|
||||
private final StartButton btnStart = new StartButton();
|
||||
|
||||
@@ -109,17 +113,6 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
||||
sliOpponents.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
sliOpponents.setFont(FSkin.getFont(12));
|
||||
|
||||
/*
|
||||
sliGamesPerMatch.setMajorTickSpacing(2);
|
||||
sliGamesPerMatch.setMinorTickSpacing(0);
|
||||
sliGamesPerMatch.setPaintTicks(false);
|
||||
sliGamesPerMatch.setPaintLabels(true);
|
||||
sliGamesPerMatch.setSnapToTicks(true);
|
||||
sliGamesPerMatch.setOpaque(false);
|
||||
sliGamesPerMatch.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
sliGamesPerMatch.setFont(FSkin.getFont(12));
|
||||
*/
|
||||
|
||||
btnRandom.setOpaque(true);
|
||||
|
||||
scrLoad.setOpaque(false);
|
||||
@@ -139,7 +132,6 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
||||
pnlOptions.add(lblOptions, "h 30px!, w 96%!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(sliOpponents, "h 40px!, w 96%!, gap 2% 0 0 5px, ax center");
|
||||
pnlOptions.add(lblDesc1, "w 96%!, gap 2% 0 0 20px");
|
||||
//pnlOptions.add(sliGamesPerMatch, "h 24px!, w 96%!, gap 2% 0 0 5px, ax center");
|
||||
pnlOptions.add(lblDesc3, "w 96%!, gap 2% 0 0 0");
|
||||
pnlOptions.setCornerDiameter(0);
|
||||
pnlOptions.add(boxUserDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||
@@ -190,8 +182,8 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
||||
public void populate() {
|
||||
parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
parentCell.getBody().add(lblTitle, "w 98%!, h 30px!, gap 1% 0 15px 15px, span 2");
|
||||
|
||||
parentCell.getBody().add(lblDesc, "ax center, gap 0 0 0 15px, span 2");
|
||||
parentCell.getBody().add(lblDesc, "ax center, gap 0 0 0 5px, span 2");
|
||||
parentCell.getBody().add(lblDecklist, "ax center, gap 0 0 0 15px, span 2");
|
||||
parentCell.getBody().add(pnlOptions, "w 40%!, gap 1% 1% 0 0, pushy, growy");
|
||||
parentCell.getBody().add(pnlDecks, "w 57%!, pushy, growy");
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ import forge.util.IStorage;
|
||||
public enum CSubmenuConstructed implements ICDoc {
|
||||
/** */
|
||||
SINGLETON_INSTANCE;
|
||||
private final VSubmenuConstructed view = VSubmenuConstructed.SINGLETON_INSTANCE;
|
||||
|
||||
private enum ESubmenuConstructedTypes { /** */
|
||||
COLORS, /** */
|
||||
@@ -70,7 +71,19 @@ public enum CSubmenuConstructed implements ICDoc {
|
||||
private final MouseAdapter madDecklist = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
if (e.getClickCount() == 2) { showDecklist(((JList) e.getSource())); }
|
||||
if (e.getClickCount() == 2) {
|
||||
final JList src = ((JList) e.getSource());
|
||||
if (src.equals(view.getLstAIDecks())) {
|
||||
if (view.getRadColorsAI().isSelected()) { return; }
|
||||
if (view.getRadThemesAI().isSelected()) { return; }
|
||||
}
|
||||
else {
|
||||
if (view.getRadColorsHuman().isSelected()) { return; }
|
||||
if (view.getRadThemesHuman().isSelected()) { return; }
|
||||
}
|
||||
|
||||
showDecklist(src);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -103,7 +116,6 @@ public enum CSubmenuConstructed implements ICDoc {
|
||||
@Override
|
||||
public void initialize() {
|
||||
final ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||
final VSubmenuConstructed view = VSubmenuConstructed.SINGLETON_INSTANCE;
|
||||
|
||||
// Radio button event handling
|
||||
view.getRadColorsAI().addActionListener(new ActionListener() { @Override
|
||||
@@ -352,8 +364,8 @@ public enum CSubmenuConstructed implements ICDoc {
|
||||
Singletons.getModel().getMatchState().setGameType(GameType.Constructed);
|
||||
|
||||
if (humanDeck != null && aiDeck != null) {
|
||||
GameNew.newGame( new PlayerStartsGame(AllZone.getHumanPlayer(), humanDeck),
|
||||
new PlayerStartsGame(AllZone.getComputerPlayer(), aiDeck) );
|
||||
GameNew.newGame(new PlayerStartsGame(AllZone.getHumanPlayer(), humanDeck),
|
||||
new PlayerStartsGame(AllZone.getComputerPlayer(), aiDeck));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ public enum VSubmenuConstructed implements IVSubmenu {
|
||||
.text("Sanctioned Format: Constructed").fontAlign(SwingConstants.CENTER)
|
||||
.fontSize(16).opaque(true).build();
|
||||
|
||||
private final FLabel lblDecklist = new FLabel.Builder()
|
||||
.text("Double click a non-random deck for its decklist.")
|
||||
.fontSize(12).build();
|
||||
|
||||
private final JPanel pnlDecksHuman = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
||||
private final JPanel pnlDecksAI = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
||||
private final JPanel pnlRadiosHuman = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
||||
@@ -167,6 +171,7 @@ public enum VSubmenuConstructed implements IVSubmenu {
|
||||
public void populate() {
|
||||
parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
parentCell.getBody().add(lblTitle, "w 98%!, h 30px!, gap 1% 0 15px 15px, span 2");
|
||||
parentCell.getBody().add(lblDecklist, "h 20px!, span 2, ax center");
|
||||
parentCell.getBody().add(pnlRadiosAI, "w 45%!, gap 1% 8% 20px 20px");
|
||||
parentCell.getBody().add(pnlRadiosHuman, "w 45%!, gap 0 0 20px 20px");
|
||||
parentCell.getBody().add(pnlDecksAI, "w 45%!, gap 1% 8% 0 0, growy, pushy");
|
||||
|
||||
Reference in New Issue
Block a user