mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
GUI: deck legality and themes improves:
* Improved formats list in deck legality panel (#6854); * Added hide button to deck legality panel (#6854); * Fixed themes names and added theme info in startup logs;
This commit is contained in:
parent
c9c1bc2b90
commit
309b3f5636
7 changed files with 46 additions and 17 deletions
|
@ -76,6 +76,18 @@ public class LegalityLabel extends JLabel {
|
|||
setPreferredSize(DIM_PREFERRED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates hide button to close legality panel (must be same size as label)
|
||||
*/
|
||||
public static JButton createHideButton() {
|
||||
JButton button = new JButton("Hide");
|
||||
button.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
button.setMinimumSize(DIM_MINIMUM);
|
||||
button.setMaximumSize(DIM_MAXIMUM);
|
||||
button.setPreferredSize(DIM_PREFERRED);
|
||||
return button;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package mage.client.deckeditor;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidator;
|
||||
import mage.client.components.LegalityLabel;
|
||||
import mage.deck.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
* @author Elandril
|
||||
|
@ -85,10 +86,15 @@ public class DeckLegalityPanel extends javax.swing.JPanel {
|
|||
remove(previewNotLegal);
|
||||
|
||||
Stream.of(
|
||||
new Standard(), new Pioneer(), new Modern(), new Pauper(), new HistoricalType2(),
|
||||
new Legacy(), new Vintage(), new Eternal(), new Frontier(), new Momir(),
|
||||
new Commander(), new Brawl(), new Oathbreaker(), new PennyDreadfulCommander(), new TinyLeaders()
|
||||
// most popular
|
||||
new Standard(), new Pioneer(), new Modern(), new Legacy(), new Vintage(), new Pauper(),
|
||||
// common
|
||||
new Commander(), new Oathbreaker(), new Brawl(),
|
||||
// other
|
||||
new Frontier(), new HistoricalType2(), new PennyDreadfulCommander()
|
||||
// not used: new Eternal(), new Momir(), new TinyLeaders()
|
||||
).forEach(this::addLegalityLabel);
|
||||
addHidePanelButton();
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
|
@ -101,6 +107,12 @@ public class DeckLegalityPanel extends javax.swing.JPanel {
|
|||
return label;
|
||||
}
|
||||
|
||||
protected void addHidePanelButton() {
|
||||
JButton button = LegalityLabel.createHideButton();
|
||||
button.addActionListener(e -> this.setVisible(false));
|
||||
add(button);
|
||||
}
|
||||
|
||||
public void validateDeck(Deck deck) {
|
||||
Arrays.stream(getComponents())
|
||||
.filter(LegalityLabel.class::isInstance)
|
||||
|
|
|
@ -319,7 +319,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
public static ThemeType getCurrentTheme() {
|
||||
if (currentTheme == null) {
|
||||
currentTheme = ThemeType.valueByName(getCachedValue(KEY_THEME, "Default Theme"));
|
||||
currentTheme = ThemeType.valueByName(getCachedValue(KEY_THEME, "Default"));
|
||||
logger.info("Using GUI theme: " + currentTheme.getName());
|
||||
}
|
||||
|
||||
return currentTheme;
|
||||
|
|
|
@ -72,7 +72,11 @@ public class HelperPanel extends JPanel {
|
|||
needFeedbackTimer = new Timer(100, evt -> SwingUtilities.invokeLater(() -> {
|
||||
needFeedbackTimer.stop();
|
||||
if (!AppUtil.isAppActive() || !AppUtil.isGameActive(this.gameId)) {
|
||||
// sound notification
|
||||
AudioManager.playFeedbackNeeded();
|
||||
// tray notification (baloon + icon blinking)
|
||||
//MageTray.instance.displayMessage("Game needs your action.");
|
||||
//MageTray.instance.blink();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.awt.*;
|
|||
|
||||
public enum ThemeType {
|
||||
// https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/_nimbusDefaults.html
|
||||
DEFAULT("Default Theme",
|
||||
DEFAULT("Default",
|
||||
"",
|
||||
true,
|
||||
false,
|
||||
|
@ -13,17 +13,17 @@ public enum ThemeType {
|
|||
true,
|
||||
true,
|
||||
true,
|
||||
new Color(169,176,190), // nimbusBlueGrey
|
||||
new Color(214,217,223), // control
|
||||
new Color(255,255,255), // nimbusLightBackground
|
||||
new Color(242,242,189), // info
|
||||
new Color(51,98,140), // nimbusBase
|
||||
new Color(169, 176, 190), // nimbusBlueGrey
|
||||
new Color(214, 217, 223), // control
|
||||
new Color(255, 255, 255), // nimbusLightBackground
|
||||
new Color(242, 242, 189), // info
|
||||
new Color(51, 98, 140), // nimbusBase
|
||||
null, // mageToolbar
|
||||
new Color(200, 200, 180, 200), // playerPanel_inactiveBackgroundColor
|
||||
new Color(200, 255, 200, 200), // playerPanel_activeBackgroundColor
|
||||
new Color(131, 94, 83, 200) // playerPanel_deadBackgroundColor
|
||||
),
|
||||
GREY("GREY",
|
||||
GREY("Grey",
|
||||
"grey-theme/",
|
||||
false,
|
||||
false,
|
||||
|
@ -42,7 +42,7 @@ public enum ThemeType {
|
|||
new Color(180, 234, 180, 200), // playerPanel_activeBackgroundColor
|
||||
new Color(99, 99, 99, 200) // playerPanel_deadBackgroundColor
|
||||
),
|
||||
SUNSET_VAPORWAVE("Sunset Vaporwave",
|
||||
SUNSET_VAPORWAVE("Vaporwave Sunset",
|
||||
"16bit-theme/",
|
||||
true,
|
||||
true,
|
||||
|
|
|
@ -80,7 +80,7 @@ public class HistoricalType2 extends Constructed {
|
|||
* done in the overridden validate function.
|
||||
*/
|
||||
public HistoricalType2() {
|
||||
super("Constructed - Historical Type 2");
|
||||
super("Constructed - Historical Type 2", "Hist. Type 2");
|
||||
|
||||
// banned cards
|
||||
banned.add("Balance");
|
||||
|
|
|
@ -136,7 +136,7 @@ enum RegenerationShieldsHint implements Hint {
|
|||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
int amount = RegenerateSourceEffect.getRegenerationShieldsAmount(game, ability.getSourceId());
|
||||
String info = "Regeneration shields: " + amount + " (permanent will be regenerated instead destroy)";
|
||||
String info = "Regeneration shields: " + amount + " (permanent will be regenerated instead of destroyed)";
|
||||
if (amount > 0) {
|
||||
return HintUtils.prepareText(info, null, HintUtils.HINT_ICON_GOOD);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue