forked from External/mage
Merge branch 'master' into master
This commit is contained in:
commit
f741fce710
69 changed files with 433 additions and 164 deletions
|
|
@ -90,7 +90,7 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||
|
||||
private static final String TITLE_NAME = "XMage";
|
||||
private static final String TITLE_NAME = "XMage (Foul Magics)";
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(MageFrame.class);
|
||||
private static final String LITE_MODE_ARG = "-lite";
|
||||
|
|
@ -297,14 +297,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
errorDialog.setLocation(100, 100);
|
||||
desktopPane.add(errorDialog, errorDialog.isModal() ? JLayeredPane.MODAL_LAYER : JLayeredPane.PALETTE_LAYER);
|
||||
|
||||
try {
|
||||
this.whatsNewDialog = new WhatsNewDialog();
|
||||
} catch (Throwable e) {
|
||||
// example: JavaFX is not supported on old MacOS with OpenJDK
|
||||
// https://bugs.openjdk.java.net/browse/JDK-8202132
|
||||
LOGGER.error("JavaFX is not supported by your system. What's new page will be disabled.", e);
|
||||
this.whatsNewDialog = null;
|
||||
}
|
||||
|
||||
PING_SENDER_EXECUTOR.scheduleAtFixedRate(SessionHandler::ping, TablesPanel.PING_SERVER_SECS, TablesPanel.PING_SERVER_SECS, TimeUnit.SECONDS);
|
||||
|
||||
|
|
@ -385,11 +377,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
setWindowTitle(); // make sure title is actual on startup
|
||||
});
|
||||
|
||||
// run what's new checks (loading in background)
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
showWhatsNewDialog(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public enum MageTray {
|
|||
private Image flashedImage;
|
||||
private TrayIcon trayIcon;
|
||||
|
||||
private int state = 0;
|
||||
private int state = 3;
|
||||
|
||||
public void install() {
|
||||
if (!SystemTray.isSupported()) {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,15 @@ package mage.client.constants;
|
|||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -14,6 +20,36 @@ public final class Constants {
|
|||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static final ImmutableList<Pair<String, String[]>> foulMagicsSets = ImmutableList.of(
|
||||
new Pair<String, String[]>("Set 2 - Phyrexians, Eldrazi, Asians - Oh my!", new String[] {
|
||||
"* March of the Machine Block",
|
||||
"* Phyrexia: All Will Be One Block",
|
||||
"* The Brothers' War Block",
|
||||
"* Dominaria United Block",
|
||||
"* Kamigawa: Neon Dynasty Block",
|
||||
"* Theros Beyond Death Block",
|
||||
"* Strixhaven: School of Mages Block",
|
||||
"* The Lost Caverns of Ixalan Block",
|
||||
"* Ikoria: Lair of Behemoths Block",
|
||||
"* Adventures in the Forgotten Realms Block",
|
||||
"Modern Horizons 3",
|
||||
"The Lord of the Rings: Tales of Middle-earth",
|
||||
"Double Masters 2022",
|
||||
"Rise of the Eldrazi",
|
||||
"Modern Horizons 2"
|
||||
}),
|
||||
new Pair<String, String[]>("Set 1 - In Da Beegeening", new String[] {
|
||||
"* Foundations Block",
|
||||
"* Guilds of Ravnica Block",
|
||||
"* Return to Ravnica Block",
|
||||
}),
|
||||
new Pair<String, String[]>("Set 0.5 - Foundationally Gaming", new String[] {
|
||||
"* Foundations Block",
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
|
||||
public static final int FRAME_MAX_HEIGHT = 367;
|
||||
public static final int FRAME_MAX_WIDTH = 256;
|
||||
public static final int ART_MAX_HEIGHT = 168;
|
||||
|
|
@ -144,5 +180,6 @@ public final class Constants {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class DeckGeneratorDialog {
|
|||
c.ipadx = 30;
|
||||
c.insets = new Insets(5, 10, 0, 10);
|
||||
c.weightx = 0.90;
|
||||
cbDeckSize = new JComboBox<>(new String[]{"40", "60"});
|
||||
cbDeckSize = new JComboBox<>(new String[]{"40", "60", "100"});
|
||||
cbDeckSize.setSelectedIndex(0);
|
||||
cbDeckSize.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
mainPanel.add(cbDeckSize, c);
|
||||
|
|
|
|||
|
|
@ -222,6 +222,46 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnExpansionSearchActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="cbFoulMagicPresets">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[120, 20]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[120, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[120, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbFoulMagicPresetSelected"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="FoulMagicPreset"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnFoulMagicPreset">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/buttons/brick.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Set to Foul Magic preset"/>
|
||||
<Property name="alignmentX" type="float" value="1.0"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[23, 23]"/>
|
||||
</Property>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnFoulMagicPresetSet"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator2">
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkPennyDreadful">
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import mage.cards.decks.PennyDreadfulLegalityUtil;
|
|||
import mage.cards.repository.*;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.*;
|
||||
import mage.client.constants.Constants;
|
||||
import mage.client.constants.Constants.SortBy;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.deckeditor.table.TableModel;
|
||||
|
|
@ -31,6 +32,8 @@ import mage.view.CardsView;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.ManaSymbolsCellRenderer;
|
||||
|
||||
import javafx.util.Pair;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import java.awt.*;
|
||||
|
|
@ -237,26 +240,44 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
|
||||
if (limited) {
|
||||
List<Predicate<MageObject>> predicates = new ArrayList<>();
|
||||
List<Predicate<MageObject>> exclusion = new ArrayList<>();
|
||||
|
||||
if (this.tbGreen.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
}
|
||||
if (this.tbRed.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.RED));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.RED));
|
||||
}
|
||||
if (this.tbBlack.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
if (this.tbBlue.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
}
|
||||
if (this.tbWhite.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
}
|
||||
|
||||
if (this.tbColorless.isSelected()) {
|
||||
predicates.add(ColorlessPredicate.instance);
|
||||
} else {
|
||||
exclusion.add(ColorlessPredicate.instance);
|
||||
}
|
||||
if (this.tbLimitColors.isSelected()) {
|
||||
filter.add(Predicates.and(Predicates.not(Predicates.or(exclusion)), Predicates.or(predicates)));
|
||||
} else {
|
||||
filter.add(Predicates.or(predicates));
|
||||
}
|
||||
filter.add(Predicates.or(predicates));
|
||||
|
||||
predicates.clear();
|
||||
if (this.tbLand.isSelected()) {
|
||||
|
|
@ -346,6 +367,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
criteria.red(this.tbRed.isSelected());
|
||||
criteria.white(this.tbWhite.isSelected());
|
||||
criteria.colorless(this.tbColorless.isSelected());
|
||||
criteria.limitColors(this.tbLimitColors.isSelected());
|
||||
|
||||
// if you add new type filter then sync it with CardType
|
||||
if (this.tbLand.isSelected()) {
|
||||
|
|
@ -559,9 +581,12 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
tbBlack = new javax.swing.JToggleButton();
|
||||
tbWhite = new javax.swing.JToggleButton();
|
||||
tbColorless = new javax.swing.JToggleButton();
|
||||
tbLimitColors = new javax.swing.JToggleButton();
|
||||
jSeparator1 = new javax.swing.JToolBar.Separator();
|
||||
cbExpansionSet = new javax.swing.JComboBox<>();
|
||||
btnExpansionSearch = new javax.swing.JButton();
|
||||
cbFoulMagicPresets = new javax.swing.JComboBox<>();
|
||||
btnFoulMagicPreset = new javax.swing.JButton();
|
||||
jSeparator2 = new javax.swing.JToolBar.Separator();
|
||||
chkPennyDreadful = new javax.swing.JCheckBox();
|
||||
btnBooster = new javax.swing.JButton();
|
||||
|
|
@ -701,6 +726,23 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
});
|
||||
tbColor.add(tbColorless);
|
||||
|
||||
tbLimitColors.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/lock.png"))); // NOI18N
|
||||
tbLimitColors.setSelected(false);
|
||||
tbLimitColors.setToolTipText("Limit results to ONLY these colors");
|
||||
tbLimitColors.setActionCommand("LimitColors");
|
||||
tbLimitColors.setFocusable(false);
|
||||
tbLimitColors.setPreferredSize(new java.awt.Dimension(28, 28));
|
||||
tbLimitColors.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
tbLimitColors.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/lock.png"))); // NOI18N
|
||||
tbLimitColors.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
tbLimitColors.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
tbLimitColorsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(tbLimitColors);
|
||||
|
||||
tbColor.add(jSeparator1);
|
||||
|
||||
reloadSetsCombobox();
|
||||
|
|
@ -741,6 +783,31 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
});
|
||||
tbColor.add(btnExpansionSearch);
|
||||
|
||||
List<String> setNames = new LinkedList<String>();
|
||||
for (Pair<String, String[]> pair : Constants.foulMagicsSets) {
|
||||
setNames.add(pair.getKey());
|
||||
}
|
||||
|
||||
DefaultComboBoxModel presetModel = new DefaultComboBoxModel<>(setNames.toArray());
|
||||
cbFoulMagicPresets.setModel(presetModel);
|
||||
|
||||
tbColor.add(cbFoulMagicPresets);
|
||||
|
||||
btnFoulMagicPreset.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/brick.png"))); // NOI18N
|
||||
btnFoulMagicPreset.setToolTipText("Set to Foul Magic preset");
|
||||
btnFoulMagicPreset.setAlignmentX(1.0F);
|
||||
btnFoulMagicPreset.setFocusable(false);
|
||||
btnFoulMagicPreset.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnFoulMagicPreset.setPreferredSize(new java.awt.Dimension(24, 24));
|
||||
btnFoulMagicPreset.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnFoulMagicPreset.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnFoulMagicPresetSet(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(btnFoulMagicPreset);
|
||||
|
||||
tbColor.add(jSeparator2);
|
||||
|
||||
chkPennyDreadful.setText("Penny Dreadful Only");
|
||||
|
|
@ -1421,7 +1488,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private void tbColorlessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbColorlessActionPerformed
|
||||
filterCardsColor(evt.getModifiers(), evt.getActionCommand());
|
||||
}//GEN-LAST:event_tbColorlessActionPerformed
|
||||
|
||||
|
||||
private void tbLimitColorsActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbColorlessActionPerformed
|
||||
filterCards();
|
||||
}
|
||||
|
||||
private void tbCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCreaturesActionPerformed
|
||||
filterCardsType(evt.getModifiers(), evt.getActionCommand());
|
||||
}//GEN-LAST:event_tbCreaturesActionPerformed
|
||||
|
|
@ -1465,6 +1536,33 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private void chkUniqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkRulesActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_chkRulesActionPerformed
|
||||
|
||||
private void btnFoulMagicPresetSet(java.awt.event.ActionEvent evt) {
|
||||
reloadSetsCombobox();
|
||||
if (cbExpansionSet.getItemAt(0).startsWith(MULTI_SETS_SELECTION_TEXT)) {
|
||||
cbExpansionSet.removeItemAt(0);
|
||||
}
|
||||
|
||||
listCodeSelected.uncheckAll();
|
||||
String[] selectedFormats = Constants.foulMagicsSets.get(this.cbFoulMagicPresets.getSelectedIndex()).getValue();
|
||||
if (selectedFormats.length == 1) {
|
||||
this.cbExpansionSet.setSelectedItem(selectedFormats[0]);
|
||||
filterCards();
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> formats = ConstructedFormats.getTypes(false);
|
||||
for (int i = 0; i < formats.size(); i++) {
|
||||
if (Arrays.stream(selectedFormats).anyMatch(formats.get(i)::equals)) {
|
||||
listCodeSelected.setChecked(i - 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
String message = String.format("%s: %s", MULTI_SETS_SELECTION_TEXT, "[Foul Magics]");
|
||||
cbExpansionSet.insertItemAt(message, 0);
|
||||
cbExpansionSet.setSelectedIndex(0);
|
||||
filterCards();
|
||||
}
|
||||
|
||||
private void btnExpansionSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExpansionSearchActionPerformed
|
||||
// search and check multiple items
|
||||
|
|
@ -1505,6 +1603,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
isSetsFilterLoading = false;
|
||||
}
|
||||
|
||||
|
||||
// update data
|
||||
filterCards();
|
||||
});
|
||||
|
|
@ -1575,12 +1674,14 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private javax.swing.JButton btnBooster;
|
||||
private javax.swing.JButton btnClear;
|
||||
private javax.swing.JButton btnExpansionSearch;
|
||||
private javax.swing.JButton btnFoulMagicPreset;
|
||||
private javax.swing.JLabel cardCount;
|
||||
private javax.swing.JLabel cardCountLabel;
|
||||
private javax.swing.JPanel cardSelectorBottomPanel;
|
||||
private javax.swing.JScrollPane cardSelectorScrollPane;
|
||||
private javax.swing.JComboBox<String> cbExpansionSet;
|
||||
private javax.swing.JComboBox<SortBy> cbSortBy;
|
||||
private javax.swing.JComboBox<SortBy> cbFoulMagicPresets;
|
||||
private javax.swing.JCheckBox chkNames;
|
||||
private javax.swing.JCheckBox chkPennyDreadful;
|
||||
private javax.swing.JCheckBox chkPiles;
|
||||
|
|
@ -1607,6 +1708,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private javax.swing.JToggleButton tbBlue;
|
||||
private javax.swing.JToolBar tbColor;
|
||||
private javax.swing.JToggleButton tbColorless;
|
||||
private javax.swing.JToggleButton tbLimitColors;
|
||||
private javax.swing.JToggleButton tbCommon;
|
||||
private javax.swing.JToggleButton tbCreatures;
|
||||
private javax.swing.JToggleButton tbEnchantments;
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ public class ConnectDialog extends MageDialog {
|
|||
});
|
||||
|
||||
btnFindBeta.setText("BETA");
|
||||
btnFindBeta.setEnabled(false);
|
||||
btnFindBeta.setToolTipText("Connect to BETA server, AI disabled (use any username without registration)");
|
||||
btnFindBeta.setAlignmentY(0.0F);
|
||||
btnFindBeta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ public class DownloadImagesDialog extends MageDialog {
|
|||
comboSets = new javax.swing.JComboBox<>();
|
||||
fillerMode1 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
|
||||
buttonSearchSet = new javax.swing.JButton();
|
||||
|
||||
panelRedownload = new javax.swing.JPanel();
|
||||
checkboxRedownload = new javax.swing.JCheckBox();
|
||||
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 5), new java.awt.Dimension(0, 3), new java.awt.Dimension(32767, 5));
|
||||
|
|
@ -354,8 +355,9 @@ public class DownloadImagesDialog extends MageDialog {
|
|||
buttonSearchSetActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
panelModeSelect.add(buttonSearchSet);
|
||||
|
||||
|
||||
panelModeInner.add(panelModeSelect);
|
||||
|
||||
panelMode.add(panelModeInner);
|
||||
|
|
@ -426,7 +428,7 @@ public class DownloadImagesDialog extends MageDialog {
|
|||
private void buttonSearchSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSearchSetActionPerformed
|
||||
FastSearchUtil.showFastSearchForStringComboBox(comboSets, FastSearchUtil.DEFAULT_EXPANSION_SEARCH_MESSAGE, 400, 500);
|
||||
}//GEN-LAST:event_buttonSearchSetActionPerformed
|
||||
|
||||
|
||||
private void buttonStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopActionPerformed
|
||||
// TODO implement stop feature for cancel button
|
||||
}//GEN-LAST:event_buttonStopActionPerformed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue