mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Switch to using hi-res shelf for achievements
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -16516,8 +16516,6 @@ forge-gui/res/skins/default/bg_draft_deck.png -text
|
||||
forge-gui/res/skins/default/bg_match.jpg -text
|
||||
forge-gui/res/skins/default/bg_splash.png -text
|
||||
forge-gui/res/skins/default/bg_texture.jpg -text
|
||||
forge-gui/res/skins/default/bg_trophy_case_shelf.png -text
|
||||
forge-gui/res/skins/default/bg_trophy_case_top.png -text
|
||||
forge-gui/res/skins/default/font1.ttf -text
|
||||
forge-gui/res/skins/default/grid_icons.png -text
|
||||
forge-gui/res/skins/default/loader.gif -text
|
||||
|
||||
@@ -37,7 +37,6 @@ public enum VSubmenuAchievements implements IVSubmenu<CSubmenuAchievements> {
|
||||
|
||||
private static final int MIN_SHELVES = 3;
|
||||
private static final int TROPHIES_PER_SHELVE = 4;
|
||||
private static final int IMAGE_SCALE = 3;
|
||||
|
||||
// Fields used with interface IVDoc
|
||||
private DragCell parentCell;
|
||||
@@ -53,7 +52,7 @@ public enum VSubmenuAchievements implements IVSubmenu<CSubmenuAchievements> {
|
||||
private VSubmenuAchievements() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
trophyCase.setMinimumSize(new Dimension(266 * IMAGE_SCALE, 0));
|
||||
trophyCase.setMinimumSize(new Dimension(FSkinProp.IMG_TROPHY_CASE_SHELF.getWidth(), 0));
|
||||
|
||||
AchievementCollection.buildComboBox(cbCollections);
|
||||
|
||||
@@ -162,7 +161,7 @@ public enum VSubmenuAchievements implements IVSubmenu<CSubmenuAchievements> {
|
||||
trophyCase.shelfCount = MIN_SHELVES;
|
||||
}
|
||||
|
||||
trophyCase.setMinimumSize(new Dimension(trophyCase.getMinimumSize().width, IMAGE_SCALE * (14 + trophyCase.shelfCount * 86)));
|
||||
trophyCase.setMinimumSize(new Dimension(trophyCase.getMinimumSize().width, (FSkinProp.IMG_TROPHY_CASE_TOP.getHeight() + trophyCase.shelfCount * FSkinProp.IMG_TROPHY_CASE_SHELF.getHeight())));
|
||||
trophyCase.setPreferredSize(trophyCase.getMinimumSize());
|
||||
scroller.revalidate();
|
||||
scroller.repaint();
|
||||
@@ -170,8 +169,8 @@ public enum VSubmenuAchievements implements IVSubmenu<CSubmenuAchievements> {
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class TrophyCase extends JPanel {
|
||||
private static final SkinImage imgTop = FSkin.getImage(FSkinProp.BG_TROPHY_CASE_TOP).scale(IMAGE_SCALE);
|
||||
private static final SkinImage imgShelf = FSkin.getImage(FSkinProp.BG_TROPHY_CASE_SHELF).scale(IMAGE_SCALE);
|
||||
private static final SkinImage imgTop = FSkin.getImage(FSkinProp.IMG_TROPHY_CASE_TOP);
|
||||
private static final SkinImage imgShelf = FSkin.getImage(FSkinProp.IMG_TROPHY_CASE_SHELF);
|
||||
private static final SkinImage imgBronzeTrophy = FSkin.getImage(FSkinProp.IMG_BRONZE_TROPHY).scale(1.8);
|
||||
private static final SkinImage imgSilverTrophy = FSkin.getImage(FSkinProp.IMG_SILVER_TROPHY).scale(1.8);
|
||||
private static final SkinImage imgGoldTrophy = FSkin.getImage(FSkinProp.IMG_GOLD_TROPHY).scale(1.8);
|
||||
@@ -212,7 +211,7 @@ public enum VSubmenuAchievements implements IVSubmenu<CSubmenuAchievements> {
|
||||
Dimension trophyPlateSize = imgTrophyPlate.getSizeForPaint(g2d);
|
||||
|
||||
x += (w - TROPHIES_PER_SHELVE * trophySize.width) / 2;
|
||||
y = imgTopSize.height + (h - trophySize.height - 12 * IMAGE_SCALE) / 2;
|
||||
y = imgTopSize.height + (h - trophySize.height - 37) / 2;
|
||||
|
||||
FontMetrics fm;
|
||||
String label;
|
||||
|
||||
@@ -1106,10 +1106,6 @@ public class FSkin {
|
||||
if (f != null) {
|
||||
FSkin.defaultFontSize = f.getSize();
|
||||
}
|
||||
|
||||
//only need to initialize trophy case images once
|
||||
SkinIcon.setIcon(FSkinProp.BG_TROPHY_CASE_TOP, defaultDir + ForgeConstants.TROPHY_CASE_TOP_FILE);
|
||||
SkinIcon.setIcon(FSkinProp.BG_TROPHY_CASE_SHELF, defaultDir + ForgeConstants.TROPHY_CASE_SHELF_FILE);
|
||||
}
|
||||
SkinFont.setBaseFont(GuiUtils.newFont(preferredDir + ForgeConstants.FONT_FILE));
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ public enum FSkinImage implements FImage {
|
||||
SILVER_TROPHY (FSkinProp.IMG_SILVER_TROPHY, SourceFile.ICONS),
|
||||
GOLD_TROPHY (FSkinProp.IMG_GOLD_TROPHY, SourceFile.ICONS),
|
||||
TROPHY_PLATE (FSkinProp.IMG_TROPHY_PLATE, SourceFile.ICONS),
|
||||
TROPHY_CASE_TOP (FSkinProp.IMG_TROPHY_CASE_TOP, SourceFile.ICONS),
|
||||
TROPHY_CASE_SHELF (FSkinProp.IMG_TROPHY_CASE_SHELF, SourceFile.ICONS),
|
||||
|
||||
//Quest Icons
|
||||
QUEST_ZEP (FSkinProp.ICO_QUEST_ZEP, SourceFile.ICONS),
|
||||
|
||||
@@ -8,9 +8,7 @@ import forge.Graphics;
|
||||
|
||||
public enum FSkinTexture implements FImage {
|
||||
BG_TEXTURE("bg_texture.jpg", true),
|
||||
BG_MATCH("bg_match.jpg", false),
|
||||
BG_TROPHY_CASE_TOP("bg_trophy_case_top.png", false),
|
||||
BG_TROPHY_CASE_SHELF("bg_trophy_case_shelf.png", false);
|
||||
BG_MATCH("bg_match.jpg", false);
|
||||
|
||||
private final String filename;
|
||||
private final boolean repeat;
|
||||
|
||||
@@ -79,22 +79,22 @@ public class AchievementsPage extends TabPage<SettingsScreen> {
|
||||
@Override
|
||||
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
|
||||
float scrollWidth = visibleWidth + extraWidth;
|
||||
float scale = scrollWidth / FSkinTexture.BG_TROPHY_CASE_TOP.getWidth();
|
||||
float scrollHeight = (FSkinTexture.BG_TROPHY_CASE_TOP.getHeight() +
|
||||
shelfCount * FSkinTexture.BG_TROPHY_CASE_SHELF.getHeight()) * scale;
|
||||
float scale = scrollWidth / FSkinImage.TROPHY_CASE_TOP.getWidth();
|
||||
float scrollHeight = (FSkinImage.TROPHY_CASE_TOP.getHeight() +
|
||||
shelfCount * FSkinImage.TROPHY_CASE_SHELF.getHeight()) * scale;
|
||||
return new ScrollBounds(scrollWidth, scrollHeight);
|
||||
}
|
||||
|
||||
private Achievement getAchievementAt(float x0, float y0) {
|
||||
float w = getScrollWidth();
|
||||
float scale = w / FSkinTexture.BG_TROPHY_CASE_TOP.getWidth();
|
||||
float trophyScale = scale / 3f * 1.8f;
|
||||
float scale = w / FSkinImage.TROPHY_CASE_TOP.getWidth();
|
||||
float trophyScale = scale * 1.8f;
|
||||
|
||||
float shelfHeight = FSkinTexture.BG_TROPHY_CASE_SHELF.getHeight() * scale;
|
||||
float shelfHeight = FSkinImage.TROPHY_CASE_SHELF.getHeight() * scale;
|
||||
float trophyWidth = FSkinImage.GOLD_TROPHY.getWidth() * trophyScale;
|
||||
float trophyHeight = FSkinImage.GOLD_TROPHY.getHeight() * trophyScale;
|
||||
float x = -getScrollLeft() + (w - TROPHIES_PER_SHELVE * trophyWidth) / 2;
|
||||
float y = -getScrollTop() + FSkinTexture.BG_TROPHY_CASE_TOP.getHeight() * scale + (shelfHeight - trophyHeight - 12 * scale) / 2;
|
||||
float y = -getScrollTop() + FSkinImage.TROPHY_CASE_TOP.getHeight() * scale + (shelfHeight - trophyHeight - 12 * scale) / 2;
|
||||
|
||||
int trophyCount = 0;
|
||||
float startX = x;
|
||||
@@ -165,16 +165,15 @@ public class AchievementsPage extends TabPage<SettingsScreen> {
|
||||
float x = -getScrollLeft();
|
||||
float y = -getScrollTop();
|
||||
float w = getScrollWidth();
|
||||
float scale = w / FSkinTexture.BG_TROPHY_CASE_TOP.getWidth();
|
||||
float trophyScale = scale / 3f * 1.8f;
|
||||
float plateScale = scale / 3f;
|
||||
float scale = w / FSkinImage.TROPHY_CASE_TOP.getWidth();
|
||||
float trophyScale = scale * 1.8f;
|
||||
|
||||
float topHeight = FSkinTexture.BG_TROPHY_CASE_TOP.getHeight() * scale;
|
||||
float shelfHeight = FSkinTexture.BG_TROPHY_CASE_SHELF.getHeight() * scale;
|
||||
float topHeight = FSkinImage.TROPHY_CASE_TOP.getHeight() * scale;
|
||||
float shelfHeight = FSkinImage.TROPHY_CASE_SHELF.getHeight() * scale;
|
||||
float trophyWidth = FSkinImage.GOLD_TROPHY.getWidth() * trophyScale;
|
||||
float trophyHeight = FSkinImage.GOLD_TROPHY.getHeight() * trophyScale;
|
||||
float plateWidth = FSkinImage.TROPHY_PLATE.getWidth() * plateScale;
|
||||
float plateHeight = FSkinImage.TROPHY_PLATE.getHeight() * plateScale;
|
||||
float plateWidth = FSkinImage.TROPHY_PLATE.getWidth() * scale;
|
||||
float plateHeight = FSkinImage.TROPHY_PLATE.getHeight() * scale;
|
||||
|
||||
float titleHeight = plateHeight * 0.55f;
|
||||
float subTitleHeight = plateHeight * 0.35f;
|
||||
@@ -186,13 +185,13 @@ public class AchievementsPage extends TabPage<SettingsScreen> {
|
||||
float plateOffset = (trophyWidth - plateWidth) / 2;
|
||||
|
||||
if (y + topHeight > 0) {
|
||||
g.drawImage(FSkinTexture.BG_TROPHY_CASE_TOP, x, y, w, topHeight);
|
||||
g.drawImage(FSkinImage.TROPHY_CASE_TOP, x, y, w, topHeight);
|
||||
}
|
||||
y += topHeight;
|
||||
|
||||
for (int i = 0; i < shelfCount; i++) {
|
||||
if (y + shelfHeight > 0) {
|
||||
g.drawImage(FSkinTexture.BG_TROPHY_CASE_SHELF, x, y, w, shelfHeight);
|
||||
g.drawImage(FSkinImage.TROPHY_CASE_SHELF, x, y, w, shelfHeight);
|
||||
}
|
||||
y += shelfHeight;
|
||||
if (y >= getHeight()) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 683 KiB After Width: | Height: | Size: 1.0 MiB |
@@ -27,8 +27,6 @@ public enum FSkinProp {
|
||||
BG_SPLASH (null, PropType.BACKGROUND),
|
||||
BG_TEXTURE (null, PropType.BACKGROUND),
|
||||
BG_MATCH (null, PropType.BACKGROUND),
|
||||
BG_TROPHY_CASE_TOP (null, PropType.BACKGROUND),
|
||||
BG_TROPHY_CASE_SHELF (null, PropType.BACKGROUND),
|
||||
|
||||
//colors
|
||||
CLR_THEME (new int[] {70, 10}, PropType.COLOR),
|
||||
@@ -232,11 +230,13 @@ public enum FSkinProp {
|
||||
IMG_PACK (new int[] {80, 760, 40, 40}, PropType.IMAGE),
|
||||
IMG_SORCERY (new int[] {160, 720, 40, 40}, PropType.IMAGE),
|
||||
|
||||
//achievement trophies
|
||||
//achievement trophies and shelf
|
||||
IMG_BRONZE_TROPHY (new int[] {0, 880, 100, 120}, PropType.IMAGE),
|
||||
IMG_SILVER_TROPHY (new int[] {100, 880, 100, 120}, PropType.IMAGE),
|
||||
IMG_GOLD_TROPHY (new int[] {200, 880, 100, 120}, PropType.IMAGE),
|
||||
IMG_TROPHY_PLATE (new int[] {300, 880, 160, 40}, PropType.IMAGE),
|
||||
IMG_TROPHY_CASE_TOP (new int[] {1, 1001, 798, 42}, PropType.IMAGE),
|
||||
IMG_TROPHY_CASE_SHELF (new int[] {1, 1043, 798, 257}, PropType.IMAGE),
|
||||
|
||||
//button images
|
||||
IMG_BTN_START_UP (new int[] {480, 200, 160, 80}, PropType.ICON),
|
||||
@@ -278,6 +278,14 @@ public enum FSkinProp {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return coords[2];
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return coords[3];
|
||||
}
|
||||
|
||||
public enum PropType {
|
||||
BACKGROUND,
|
||||
COLOR,
|
||||
|
||||
Reference in New Issue
Block a user