mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Re-hooked up phase labels to skin color palette.
This commit is contained in:
@@ -135,11 +135,12 @@ public class FView {
|
||||
ForgePreferences.HomeMenus.valueOf(Singletons.getModel().getPreferences().getPref(FPref.UI_HOMEMENU));
|
||||
|
||||
switch(lastMenu) {
|
||||
case draft: g.getHomeView().showDraftMenu(); break;
|
||||
case sealed: g.getHomeView().showSealedMenu(); break;
|
||||
case quest: g.getHomeView().showQuestMenu(); break;
|
||||
case settings: g.getHomeView().showSettingsMenu(); break;
|
||||
case utilities: g.getHomeView().showUtilitiesMenu(); break;
|
||||
case constructed: g.getHomeView().getBtnConstructed().grabFocus(); break;
|
||||
case draft: g.getHomeView().getBtnDraft().grabFocus(); break;
|
||||
case sealed: g.getHomeView().getBtnSealed(); break;
|
||||
case quest: g.getHomeView().getBtnQuest(); break;
|
||||
case settings: g.getHomeView().getBtnSettings(); break;
|
||||
case utilities: g.getHomeView().getBtnUtilities(); break;
|
||||
default: g.getHomeView().showConstructedMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +173,17 @@ public class HomeTopLevel extends FPanel {
|
||||
pnlMenu.add(btnExit, constraints);
|
||||
|
||||
control = new ControlHomeUI(this);
|
||||
final ForgePreferences.HomeMenus lastMenu =
|
||||
ForgePreferences.HomeMenus.valueOf(Singletons.getModel().getPreferences().getPref(FPref.UI_HOMEMENU));
|
||||
|
||||
switch(lastMenu) {
|
||||
case draft: showDraftMenu(); break;
|
||||
case sealed: showSealedMenu(); break;
|
||||
case quest: showQuestMenu(); break;
|
||||
case settings: showSettingsMenu(); break;
|
||||
case utilities: showUtilitiesMenu(); break;
|
||||
default: showConstructedMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/** Opens menu for constructed mode. */
|
||||
@@ -330,4 +341,14 @@ public class HomeTopLevel extends FPanel {
|
||||
public JButton getBtnQuest() {
|
||||
return this.btnQuest;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnSettings() {
|
||||
return this.btnSettings;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnUtilities() {
|
||||
return this.btnUtilities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ public class ViewField extends FRoundedPanel {
|
||||
private JLabel lblAvatar, lblLife;
|
||||
private final Image img;
|
||||
private final Color transparent = new Color(0, 0, 0, 0);
|
||||
private final Color hoverBG = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_HOVER);
|
||||
|
||||
private final Color clrHover, clrPhaseActiveEnabled, clrPhaseActiveDisabled,
|
||||
clrPhaseInactiveEnabled, clrPhaseInactiveDisabled;
|
||||
/**
|
||||
* Assembles Swing components of player field instance.
|
||||
*
|
||||
@@ -101,6 +101,12 @@ public class ViewField extends FRoundedPanel {
|
||||
this.hoverBorder = new LineBorder(this.skin.getColor(FSkin.Colors.CLR_BORDERS), 1);
|
||||
this.counter = -1;
|
||||
|
||||
this.clrHover = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_HOVER);
|
||||
this.clrPhaseActiveEnabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_ACTIVE_ENABLED);
|
||||
this.clrPhaseInactiveEnabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_INACTIVE_ENABLED);
|
||||
this.clrPhaseActiveDisabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_ACTIVE_DISABLED);
|
||||
this.clrPhaseInactiveDisabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_INACTIVE_DISABLED);
|
||||
|
||||
// Player icon logic
|
||||
String filename;
|
||||
if (player.isHuman()) {
|
||||
@@ -644,7 +650,7 @@ public class ViewField extends FRoundedPanel {
|
||||
public class DetailLabel extends JLabel {
|
||||
private final Dimension labelSize = new Dimension(40, 25);
|
||||
private Color defaultBG;
|
||||
private final Color hoverBG;
|
||||
private final Color clrHover;
|
||||
private Color clrBorders;
|
||||
private final MouseAdapter madHover;
|
||||
private int w, h, padding;
|
||||
@@ -695,7 +701,7 @@ public class ViewField extends FRoundedPanel {
|
||||
this.madHover = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
DetailLabel.this.setBackground(DetailLabel.this.hoverBG);
|
||||
DetailLabel.this.setBackground(DetailLabel.this.clrHover);
|
||||
DetailLabel.this.clrBorders = ViewField.this.skin.getColor(FSkin.Colors.CLR_BORDERS);
|
||||
}
|
||||
|
||||
@@ -706,7 +712,7 @@ public class ViewField extends FRoundedPanel {
|
||||
}
|
||||
};
|
||||
|
||||
this.hoverBG = ViewField.this.skin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
this.clrHover = ViewField.this.skin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
this.clrBorders = ViewField.this.transparent;
|
||||
}
|
||||
|
||||
@@ -838,15 +844,15 @@ public class ViewField extends FRoundedPanel {
|
||||
|
||||
// Set color according to skip or active or hover state of label
|
||||
if (this.hover) {
|
||||
c = hoverBG;
|
||||
} else if (this.enabled) {
|
||||
c = Color.green;
|
||||
c = clrHover;
|
||||
} else if (this.active && this.enabled) {
|
||||
c = clrPhaseActiveEnabled;
|
||||
} else if (!this.active && this.enabled) {
|
||||
c = clrPhaseInactiveEnabled;
|
||||
} else if (this.active && !this.enabled) {
|
||||
c = clrPhaseActiveDisabled;
|
||||
} else {
|
||||
c = Color.red;
|
||||
}
|
||||
|
||||
if (!this.active && !this.hover) {
|
||||
c = c.darker().darker();
|
||||
c = clrPhaseInactiveDisabled;
|
||||
}
|
||||
|
||||
// Center vertically and horizontally. Show border if active.
|
||||
|
||||
@@ -53,14 +53,24 @@ public class FSkin {
|
||||
}
|
||||
|
||||
/** */
|
||||
public enum Colors implements SkinProp { /** */
|
||||
CLR_THEME, /** */
|
||||
CLR_BORDERS, /** */
|
||||
CLR_ZEBRA, /** */
|
||||
CLR_HOVER, /** */
|
||||
CLR_ACTIVE, /** */
|
||||
CLR_INACTIVE, /** */
|
||||
CLR_TEXT, /** */
|
||||
public enum Colors implements SkinProp, Coords { /** */
|
||||
CLR_THEME (new int[] {70, 10}), /** */
|
||||
CLR_BORDERS (new int[] {70, 30}), /** */
|
||||
CLR_ZEBRA (new int[] {70, 50}), /** */
|
||||
CLR_HOVER (new int[] {70, 70}), /** */
|
||||
CLR_ACTIVE (new int[] {70, 90}), /** */
|
||||
CLR_INACTIVE (new int[] {70, 110}), /** */
|
||||
CLR_TEXT (new int[] {70, 130}), /** */
|
||||
CLR_PHASE_INACTIVE_ENABLED (new int[] {70, 150}), /** */
|
||||
CLR_PHASE_INACTIVE_DISABLED (new int[] {70, 170}), /** */
|
||||
CLR_PHASE_ACTIVE_ENABLED (new int[] {70, 190}), /** */
|
||||
CLR_PHASE_ACTIVE_DISABLED (new int[] {70, 210});
|
||||
|
||||
private int[] coords;
|
||||
/** @param xy   int[] coordinates */
|
||||
Colors(int[] xy) { this.coords = xy; }
|
||||
/** @return int[] */
|
||||
public int[] getCoords() { return coords; }
|
||||
}
|
||||
|
||||
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
|
||||
@@ -504,15 +514,8 @@ public class FSkin {
|
||||
this.setIcon(Backgrounds.BG_TEXTURE, preferredDir + FILE_TEXTURE_BG);
|
||||
this.setIcon(Backgrounds.BG_MATCH, preferredDir + FILE_MATCH_BG);
|
||||
|
||||
this.setColor(Colors.CLR_THEME, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 10)));
|
||||
this.setColor(Colors.CLR_BORDERS, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 30)));
|
||||
this.setColor(Colors.CLR_ZEBRA, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 50)));
|
||||
this.setColor(Colors.CLR_HOVER, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 70)));
|
||||
this.setColor(Colors.CLR_ACTIVE, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 90)));
|
||||
this.setColor(Colors.CLR_INACTIVE, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 110)));
|
||||
this.setColor(Colors.CLR_TEXT, this.getColorFromPixel(bimPreferredSprite.getRGB(70, 130)));
|
||||
|
||||
// Run through enums and load their coords.
|
||||
for (Colors e : Colors.values()) { this.setColor(e); }
|
||||
for (ZoneIcons e : ZoneIcons.values()) { this.setIcon(e); }
|
||||
for (ManaIcons e : ManaIcons.values()) { this.setImage(e); }
|
||||
for (ColorlessManaIcons e : ColorlessManaIcons.values()) { this.setImage(e); }
|
||||
@@ -760,8 +763,12 @@ public class FSkin {
|
||||
this.icons.put(s0, new ImageIcon(bimCreatures.getSubimage(x0, y0, w0, h0)));
|
||||
}
|
||||
|
||||
private void setColor(final SkinProp s0, final Color c0) {
|
||||
this.colors.put(s0, c0);
|
||||
private void setColor(final SkinProp s0) {
|
||||
int[] coords = ((Coords) s0).getCoords();
|
||||
int x0 = coords[0];
|
||||
int y0 = coords[1];
|
||||
|
||||
this.colors.put(s0, getColorFromPixel(bimPreferredSprite.getRGB(x0, y0)));
|
||||
}
|
||||
|
||||
private void setFont(int size) {
|
||||
|
||||
Reference in New Issue
Block a user