support prefixes (HitCirclePrefix, ScorePrefix), and use dummy instead of complaining when image can't be found
This commit is contained in:
@@ -180,31 +180,31 @@ public enum GameImage {
|
|||||||
RANKING_TITLE ("ranking-title", "png"),
|
RANKING_TITLE ("ranking-title", "png"),
|
||||||
RANKING_MAXCOMBO ("ranking-maxcombo", "png"),
|
RANKING_MAXCOMBO ("ranking-maxcombo", "png"),
|
||||||
RANKING_ACCURACY ("ranking-accuracy", "png"),
|
RANKING_ACCURACY ("ranking-accuracy", "png"),
|
||||||
DEFAULT_0 ("default-0", "png"),
|
DEFAULT_0 ("default-0", "png", true, "0"),
|
||||||
DEFAULT_1 ("default-1", "png"),
|
DEFAULT_1 ("default-1", "png", true, "1"),
|
||||||
DEFAULT_2 ("default-2", "png"),
|
DEFAULT_2 ("default-2", "png", true, "2"),
|
||||||
DEFAULT_3 ("default-3", "png"),
|
DEFAULT_3 ("default-3", "png", true, "3"),
|
||||||
DEFAULT_4 ("default-4", "png"),
|
DEFAULT_4 ("default-4", "png", true, "4"),
|
||||||
DEFAULT_5 ("default-5", "png"),
|
DEFAULT_5 ("default-5", "png", true, "5"),
|
||||||
DEFAULT_6 ("default-6", "png"),
|
DEFAULT_6 ("default-6", "png", true, "6"),
|
||||||
DEFAULT_7 ("default-7", "png"),
|
DEFAULT_7 ("default-7", "png", true, "7"),
|
||||||
DEFAULT_8 ("default-8", "png"),
|
DEFAULT_8 ("default-8", "png", true, "8"),
|
||||||
DEFAULT_9 ("default-9", "png"),
|
DEFAULT_9 ("default-9", "png", true, "9"),
|
||||||
SCORE_0 ("score-0", "png"),
|
SCORE_0 ("score-0", "png", true, "0"),
|
||||||
SCORE_1 ("score-1", "png"),
|
SCORE_1 ("score-1", "png", true, "1"),
|
||||||
SCORE_2 ("score-2", "png"),
|
SCORE_2 ("score-2", "png", true, "2"),
|
||||||
SCORE_3 ("score-3", "png"),
|
SCORE_3 ("score-3", "png", true, "3"),
|
||||||
SCORE_4 ("score-4", "png"),
|
SCORE_4 ("score-4", "png", true, "4"),
|
||||||
SCORE_5 ("score-5", "png"),
|
SCORE_5 ("score-5", "png", true, "5"),
|
||||||
SCORE_6 ("score-6", "png"),
|
SCORE_6 ("score-6", "png", true, "6"),
|
||||||
SCORE_7 ("score-7", "png"),
|
SCORE_7 ("score-7", "png", true, "7"),
|
||||||
SCORE_8 ("score-8", "png"),
|
SCORE_8 ("score-8", "png", true, "8"),
|
||||||
SCORE_9 ("score-9", "png"),
|
SCORE_9 ("score-9", "png", true, "9"),
|
||||||
SCORE_COMMA ("score-comma", "png"),
|
SCORE_COMMA ("score-comma", "png", true, "comma"),
|
||||||
SCORE_DOT ("score-dot", "png"),
|
SCORE_DOT ("score-dot", "png", true, "dot"),
|
||||||
SCORE_PERCENT ("score-percent", "png"),
|
SCORE_PERCENT ("score-percent", "png", true, "percent"),
|
||||||
SCORE_X ("score-x", "png"),
|
SCORE_X ("score-x", "png", true, "x"),
|
||||||
LIGHTING ("lighting", "png"),
|
LIGHTING ("lighting", "png", true, "0"),
|
||||||
|
|
||||||
// Game Mods
|
// Game Mods
|
||||||
MOD_EASY ("selection-mod-easy", "png", false, false),
|
MOD_EASY ("selection-mod-easy", "png", false, false),
|
||||||
@@ -374,7 +374,7 @@ public enum GameImage {
|
|||||||
IMG_JPG = 2;
|
IMG_JPG = 2;
|
||||||
|
|
||||||
/** The file name. */
|
/** The file name. */
|
||||||
private final String filename;
|
private String filename;
|
||||||
|
|
||||||
/** The formatted file name string (for loading multiple images). */
|
/** The formatted file name string (for loading multiple images). */
|
||||||
private String filenameFormat;
|
private String filenameFormat;
|
||||||
@@ -506,6 +506,11 @@ public enum GameImage {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used for when prefixes change
|
||||||
|
*/
|
||||||
|
public void update() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of HD/SD file name suffixes based on the current options
|
* Returns an array of HD/SD file name suffixes based on the current options
|
||||||
* and UI scale.
|
* and UI scale.
|
||||||
@@ -514,6 +519,23 @@ public enum GameImage {
|
|||||||
return (Options.loadHDImages() && uiscale >= 1) ? SUFFIXES_HD : SUFFIXES_SD;
|
return (Options.loadHDImages() && uiscale >= 1) ? SUFFIXES_HD : SUFFIXES_SD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String suffix;
|
||||||
|
private boolean isPrefixable;
|
||||||
|
|
||||||
|
GameImage(String filename, String type, boolean isPrefixable, String suffix) {
|
||||||
|
this(filename, type, true, false);
|
||||||
|
this.isPrefixable = isPrefixable;
|
||||||
|
this.suffix = suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePrefix(String prefix) {
|
||||||
|
if (isPrefixable) {
|
||||||
|
this.filename = prefix + "-" + suffix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for game-related images (beatmap-skinnable and preloaded).
|
* Constructor for game-related images (beatmap-skinnable and preloaded).
|
||||||
* @param filename the image file name
|
* @param filename the image file name
|
||||||
@@ -652,6 +674,14 @@ public enum GameImage {
|
|||||||
process();
|
process();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String filenamebackup = filename;
|
||||||
|
filename = "dummy";
|
||||||
|
if ((defaultImage = loadImageSingle(null)) != null) {
|
||||||
|
isSkinned = false;
|
||||||
|
process();
|
||||||
|
filename = filenamebackup;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ErrorHandler.error(String.format("Could not find default image '%s'.", filename), null, false);
|
ErrorHandler.error(String.format("Could not find default image '%s'.", filename), null, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,21 +167,12 @@ public class Skin {
|
|||||||
* [Fonts]
|
* [Fonts]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** The prefix for the hitcircle font sprites. */
|
|
||||||
protected String hitCirclePrefix = "default";
|
|
||||||
|
|
||||||
/** How much should the hitcircle font sprites overlap? */
|
/** How much should the hitcircle font sprites overlap? */
|
||||||
protected int hitCircleOverlap = -2;
|
protected int hitCircleOverlap = -2;
|
||||||
|
|
||||||
/** The prefix for the score font sprites. */
|
|
||||||
protected String scorePrefix = "score";
|
|
||||||
|
|
||||||
/** How much should the score font sprites overlap? */
|
/** How much should the score font sprites overlap? */
|
||||||
protected int scoreOverlap = 0;
|
protected int scoreOverlap = 0;
|
||||||
|
|
||||||
/** The prefix for the combo font sprites. */
|
|
||||||
protected String comboPrefix = "score";
|
|
||||||
|
|
||||||
/** How much should the combo font sprites overlap? */
|
/** How much should the combo font sprites overlap? */
|
||||||
protected int comboOverlap = 0;
|
protected int comboOverlap = 0;
|
||||||
|
|
||||||
@@ -342,31 +333,16 @@ public class Skin {
|
|||||||
*/
|
*/
|
||||||
public Color getStarBreakAdditiveColor() { return starBreakAdditive; }
|
public Color getStarBreakAdditiveColor() { return starBreakAdditive; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the prefix for the hit circle font sprites.
|
|
||||||
*/
|
|
||||||
public String getHitCircleFontPrefix() { return hitCirclePrefix; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of overlap between the hit circle font sprites.
|
* Returns the amount of overlap between the hit circle font sprites.
|
||||||
*/
|
*/
|
||||||
public int getHitCircleFontOverlap() { return hitCircleOverlap; }
|
public int getHitCircleFontOverlap() { return hitCircleOverlap; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the prefix for the score font sprites.
|
|
||||||
*/
|
|
||||||
public String getScoreFontPrefix() { return scorePrefix; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of overlap between the score font sprites.
|
* Returns the amount of overlap between the score font sprites.
|
||||||
*/
|
*/
|
||||||
public int getScoreFontOverlap() { return scoreOverlap; }
|
public int getScoreFontOverlap() { return scoreOverlap; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the prefix for the combo font sprites.
|
|
||||||
*/
|
|
||||||
public String getComboFontPrefix() { return comboPrefix; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of overlap between the combo font sprites.
|
* Returns the amount of overlap between the combo font sprites.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package itdelatrisu.opsu.skins;
|
package itdelatrisu.opsu.skins;
|
||||||
|
|
||||||
import itdelatrisu.opsu.ErrorHandler;
|
import itdelatrisu.opsu.ErrorHandler;
|
||||||
|
import itdelatrisu.opsu.GameImage;
|
||||||
import itdelatrisu.opsu.Utils;
|
import itdelatrisu.opsu.Utils;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -235,19 +236,41 @@ public class SkinLoader {
|
|||||||
try {
|
try {
|
||||||
switch (tokens[0]) {
|
switch (tokens[0]) {
|
||||||
case "HitCirclePrefix":
|
case "HitCirclePrefix":
|
||||||
skin.hitCirclePrefix = tokens[1];
|
GameImage.DEFAULT_0.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_1.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_2.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_3.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_4.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_5.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_6.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_7.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_8.updatePrefix(tokens[1]);
|
||||||
|
GameImage.DEFAULT_9.updatePrefix(tokens[1]);
|
||||||
break;
|
break;
|
||||||
case "HitCircleOverlap":
|
case "HitCircleOverlap":
|
||||||
skin.hitCircleOverlap = Integer.parseInt(tokens[1]);
|
skin.hitCircleOverlap = Integer.parseInt(tokens[1]);
|
||||||
break;
|
break;
|
||||||
case "ScorePrefix":
|
case "ScorePrefix":
|
||||||
skin.scorePrefix = tokens[1];
|
GameImage.SCORE_0.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_1.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_2.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_3.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_4.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_5.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_6.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_7.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_8.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_9.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_COMMA.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_PERCENT.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_X.updatePrefix(tokens[1]);
|
||||||
|
GameImage.SCORE_DOT.updatePrefix(tokens[1]);
|
||||||
break;
|
break;
|
||||||
case "ScoreOverlap":
|
case "ScoreOverlap":
|
||||||
skin.scoreOverlap = Integer.parseInt(tokens[1]);
|
skin.scoreOverlap = Integer.parseInt(tokens[1]);
|
||||||
break;
|
break;
|
||||||
case "ComboPrefix":
|
case "ComboPrefix":
|
||||||
skin.comboPrefix = tokens[1];
|
// TODO: seems like this uses the score images
|
||||||
break;
|
break;
|
||||||
case "ComboOverlap":
|
case "ComboOverlap":
|
||||||
skin.comboOverlap = Integer.parseInt(tokens[1]);
|
skin.comboOverlap = Integer.parseInt(tokens[1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user