Added missing "SliderBorder" field to BeatmapParser.
Use beatmap.getSliderBorderColor() to get the slider border color for a beatmap. Also adds the field to the beatmap cache, and fixes a bug where format changes would cause an exception when preparing statements in the new format. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -185,6 +185,9 @@ public class Beatmap implements Comparable<Beatmap> {
|
||||
/** Whether the combo is the default skin combo (true) or a beatmap combo (false). */
|
||||
public boolean isDefaultCombo = true;
|
||||
|
||||
/** Slider border color. If null, the skin value is used. */
|
||||
public Color sliderBorder;
|
||||
|
||||
/**
|
||||
* [HitObjects]
|
||||
*/
|
||||
@@ -257,6 +260,15 @@ public class Beatmap implements Comparable<Beatmap> {
|
||||
return (Options.useUnicodeMetadata() && !artistUnicode.isEmpty()) ? artistUnicode : artist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the slider border color.
|
||||
* If the beatmap does not provide a color, the skin color will be returned instead.
|
||||
* @return the slider border color
|
||||
*/
|
||||
public Color getSliderBorderColor() {
|
||||
return (sliderBorder != null) ? sliderBorder : Options.getSkin().getSliderBorderColor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the beatmap background.
|
||||
* @param width the container width
|
||||
@@ -441,4 +453,27 @@ public class Beatmap implements Comparable<Beatmap> {
|
||||
this.isDefaultCombo = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link #sliderBorder} field formatted as a string,
|
||||
* or null if the field is null.
|
||||
*/
|
||||
public String sliderBorderToString() {
|
||||
if (sliderBorder == null)
|
||||
return null;
|
||||
|
||||
return String.format("%d,%d,%d", sliderBorder.getRed(), sliderBorder.getGreen(), sliderBorder.getBlue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link #sliderBorder} field from a string.
|
||||
* @param s the string
|
||||
*/
|
||||
public void sliderBorderFromString(String s) {
|
||||
if (s == null)
|
||||
return;
|
||||
|
||||
String[] rgb = s.split(",");
|
||||
this.sliderBorder = new Color(new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])));
|
||||
}
|
||||
}
|
||||
@@ -504,6 +504,12 @@ public class BeatmapParser {
|
||||
if ((tokens = tokenize(line)) == null)
|
||||
continue;
|
||||
try {
|
||||
String[] rgb = tokens[1].split(",");
|
||||
Color color = new Color(
|
||||
Integer.parseInt(rgb[0]),
|
||||
Integer.parseInt(rgb[1]),
|
||||
Integer.parseInt(rgb[2])
|
||||
);
|
||||
switch (tokens[0]) {
|
||||
case "Combo1":
|
||||
case "Combo2":
|
||||
@@ -513,12 +519,11 @@ public class BeatmapParser {
|
||||
case "Combo6":
|
||||
case "Combo7":
|
||||
case "Combo8":
|
||||
String[] rgb = tokens[1].split(",");
|
||||
colors.add(new Color(
|
||||
Integer.parseInt(rgb[0]),
|
||||
Integer.parseInt(rgb[1]),
|
||||
Integer.parseInt(rgb[2])
|
||||
));
|
||||
colors.add(color);
|
||||
break;
|
||||
case "SliderBorder":
|
||||
beatmap.sliderBorder = color;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user