mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fix some issues when rendering Level up cards
This commit is contained in:
@@ -272,36 +272,47 @@ public class FCardImageRenderer {
|
||||
String [] paragraphs = linebreakPattern.split(text);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String text1 = "", text2 = "", text3 = "";
|
||||
String level2 = null, level3 = null;
|
||||
String level2 = "", level3 = "";
|
||||
String ptOverride2 = null, ptOverride3 = null;
|
||||
boolean matchedLevel = false;
|
||||
for (String pg : paragraphs) {
|
||||
if (pg.matches(".*[0-9]+-[0-9]+")) {
|
||||
if (pg.matches("(.*[0-9]+-[0-9]+)|(.*[0-9]+\\+)")) {
|
||||
//add space before numbers in case there is no space.
|
||||
pg = pg.replaceAll("([^0-9 ]+)(([0-9]+-[0-9]+)|([0-9]+\\+))", "$1 $2");
|
||||
if (level2.isEmpty()) {
|
||||
text1 = sb.toString();
|
||||
sb.setLength(0);
|
||||
level2 = pg;
|
||||
matchedLevel = true;
|
||||
continue;
|
||||
} else if (pg.matches(".*[0-9]+\\+")) {
|
||||
} else {
|
||||
text2 = sb.toString();
|
||||
sb.setLength(0);
|
||||
level3 = pg;
|
||||
matchedLevel = true;
|
||||
}
|
||||
sb.setLength(0);
|
||||
continue;
|
||||
}
|
||||
if (pg.matches("[0-9]+/[0-9]+")) {
|
||||
if (ptOverride2 == null)
|
||||
ptOverride2 = pg;
|
||||
else
|
||||
ptOverride3 = pg;
|
||||
continue;
|
||||
}
|
||||
if (!matchedLevel) {
|
||||
if (sb.length() > 0)
|
||||
sb.append("\n");
|
||||
sb.append(pg);
|
||||
} else {
|
||||
}
|
||||
text3 = sb.toString();
|
||||
//handle the case that translated text doesn't contains P/T info.
|
||||
if (ptOverride2 == null) {
|
||||
paragraphs = linebreakPattern.split(state.getOracleText());
|
||||
for (String pg : paragraphs) {
|
||||
if (pg.matches("[0-9]+/[0-9]+")) {
|
||||
if (ptOverride2 == null)
|
||||
ptOverride2 = pg;
|
||||
else
|
||||
ptOverride3 = pg;
|
||||
}
|
||||
matchedLevel = false;
|
||||
}
|
||||
text3 = sb.toString();
|
||||
}
|
||||
|
||||
int textX = x + artInset;
|
||||
|
||||
//draw text box
|
||||
|
||||
Reference in New Issue
Block a user