* GUI: added card icon for commander on battlefield;

Card icons: added support of custom card icon colors;
This commit is contained in:
Oleg Agafonov 2021-07-23 19:51:45 +04:00
parent 06ae494c5b
commit 4d1985476f
17 changed files with 327 additions and 116 deletions

View file

@ -7,7 +7,8 @@ package mage.abilities.icon;
*/
public enum CardIconCategory {
ABILITY, // example: flying
PLAYABLE_COUNT,
SYSTEM
ABILITY, // example: flying (on left side)
PLAYABLE_COUNT, // on bottom left corner
SYSTEM, // example: too many icons combines in the one icon (on left side)
COMMANDER // example: commander (on top center icon)
}

View file

@ -0,0 +1,46 @@
package mage.abilities.icon;
import java.awt.*;
/**
* For GUI: custom color modification for card icons (e.g. for special card icons like commander)
* <p>
* Card icons uses svg, so all color settings must be predefined on app's loading
* <p>
* TODO: current version uses panels (initCardIconsPanels) to define custom colors,
* but it can be removed to single/dynamic icon in the future (example: r/g/b dynamic semaphore icon)
*
* @author JayDi85
*/
public enum CardIconColor {
DEFAULT(),
YELLOW(new Color(231, 203, 18), new Color(76, 76, 76), new Color(0, 0, 0)),
RED(new Color(255, 31, 75), new Color(76, 76, 76), new Color(229, 228, 228));
private final Color fillColor;
private final Color strokeColor;
private final Color textColor;
CardIconColor() {
this(null, null, null);
}
CardIconColor(Color fillColor, Color strokeColor, Color textColor) {
this.fillColor = fillColor;
this.strokeColor = strokeColor;
this.textColor = textColor;
}
public Color getFillColor() {
return fillColor;
}
public Color getStrokeColor() {
return strokeColor;
}
public Color getTextColor() {
return textColor;
}
}

View file

@ -10,6 +10,7 @@ public class CardIconRenderSettings {
// custom settings for test render dialog
CardIconPosition customPosition = null;
CardIconOrder customOrder = null;
CardIconColor customColor = null;
int customMaxVisibleCount = 0;
int customIconSizePercent = 0;
boolean debugMode = false;
@ -27,6 +28,11 @@ public class CardIconRenderSettings {
return this;
}
public CardIconRenderSettings withCustomColor(CardIconColor customColor) {
this.customColor = customColor;
return this;
}
public CardIconRenderSettings withCustomMaxVisibleCount(int customMaxVisibleCount) {
this.customMaxVisibleCount = customMaxVisibleCount;
return this;
@ -50,6 +56,10 @@ public class CardIconRenderSettings {
return customPosition;
}
public CardIconColor getCustomColor() {
return customColor;
}
public int getCustomIconSizePercent() {
return customIconSizePercent;
}

View file

@ -34,6 +34,8 @@ public enum CardIconType {
OTHER_FACEDOWN("prepared/reply-fill.svg", CardIconCategory.ABILITY, 100),
OTHER_COST_X("prepared/square-fill.svg", CardIconCategory.ABILITY, 100),
//
COMMANDER("prepared/crown.svg", CardIconCategory.COMMANDER, 100), // TODO: fix big size, see CardIconsPanel
//
SYSTEM_COMBINED("prepared/square-fill.svg", CardIconCategory.SYSTEM, 1000), // inner usage, must use last order
SYSTEM_DEBUG("prepared/link.svg", CardIconCategory.SYSTEM, 1000); // used for test render dialog

View file

@ -0,0 +1,31 @@
package mage.abilities.icon.other;
import mage.abilities.icon.CardIcon;
import mage.abilities.icon.CardIconType;
/**
* @author JayDi85
*/
public enum CommanderCardIcon implements CardIcon {
instance;
@Override
public CardIconType getIconType() {
return CardIconType.COMMANDER;
}
@Override
public String getText() {
return "";
}
@Override
public String getHint() {
return "Card is commander";
}
@Override
public CardIcon copy() {
return instance;
}
}