Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2024-02-01 15:59:36 -05:00
6 changed files with 23 additions and 14 deletions

View File

@@ -91,6 +91,8 @@ public class MapLocalesDialog extends BaseDialog{
t.button("@edit", Icon.edit, this::editDialog).size(210f, 64f);
}).growX();
resized(this::buildMain);
buttons.button("?", () -> ui.showInfo("@locales.info")).size(60f, 64f).uniform();
shown(this::setup);
@@ -158,7 +160,7 @@ public class MapLocalesDialog extends BaseDialog{
saved = false;
buildMain();
}).padTop(10f).size(400f, 50f).fillX().row();
}).padTop(10f).size(cardWidth, 50f).fillX().row();
}).right();
}
@@ -184,7 +186,7 @@ public class MapLocalesDialog extends BaseDialog{
selectedLocale = name;
buildTables();
}).update(b -> b.setChecked(selectedLocale.equals(name))).size(300f, 50f);
}).update(b -> b.setChecked(selectedLocale.equals(name))).width(200f).minHeight(50f);
p.button(Icon.edit, Styles.flati, () -> localeEditDialog(name)).size(50f);
p.button(Icon.trash, Styles.flati, () -> ui.showConfirm("@confirm", "@locales.deletelocale", () -> {
locales.remove(name);
@@ -196,7 +198,7 @@ public class MapLocalesDialog extends BaseDialog{
}
}
}).row();
langs.button("@add", Icon.add, this::addLocaleDialog).padTop(10f).width(400f);
langs.button("@add", Icon.add, this::addLocaleDialog).padTop(10f).width(250f);
}
private void buildMain(){
@@ -206,7 +208,7 @@ public class MapLocalesDialog extends BaseDialog{
main.image().color(Pal.gray).height(3f).growX().expandY().top().row();
main.pane(p -> {
int cols = Math.max(1, (Core.graphics.getWidth() - 630) / ((int)cardWidth + 10));
int cols = Math.max(1, (int)((Core.graphics.getWidth() / Scl.scl() - 410f) / cardWidth) - 1);
if(props.size == 0){
main.add("@empty").center().row();
return;
@@ -512,7 +514,7 @@ public class MapLocalesDialog extends BaseDialog{
propView.image().color(Pal.gray).height(3f).fillX().top().row();
propView.pane(p -> {
int cols = (Core.graphics.getWidth() - 100) / ((int)cardWidth + 10);
int cols = Math.max(1, (int)((Core.graphics.getWidth() / Scl.scl() - 100f) / cardWidth));
if(cols == 0){
propView.add("@empty").center().row();
return;
@@ -720,7 +722,9 @@ public class MapLocalesDialog extends BaseDialog{
if(!locales.containsKey(key)) return "";
for(var prop : locales.get(key).entries()){
data.append(prop.key).append(" = ").append(prop.value).append("\n");
// Convert \n in plain text to \\n, then convert newlines to \n
data.append(prop.key).append(" = ").append(prop.value
.replace("\\n", "\\\\n").replace("\n", "\\n")).append("\n");
}
return data.toString();
@@ -738,7 +742,9 @@ public class MapLocalesDialog extends BaseDialog{
}else{
int sepIndex = line.indexOf(" = ");
if(sepIndex != -1 && !currentLocale.isEmpty()){
bundles.get(currentLocale).put(line.substring(0, sepIndex), line.substring(sepIndex + 3));
// Convert \n in file to newlines in text, then revert newlines with escape characters
bundles.get(currentLocale).put(line.substring(0, sepIndex), line.substring(sepIndex + 3)
.replace("\\n", "\n").replace("\\\n", "\\n"));
}
}
}
@@ -752,7 +758,9 @@ public class MapLocalesDialog extends BaseDialog{
for(var line : data.split("\\r?\\n|\\r")){
int sepIndex = line.indexOf(" = ");
if(sepIndex != -1){
map.put(line.substring(0, sepIndex), line.substring(sepIndex + 3));
// Convert \n in file to newlines in text, then revert newlines with escape characters
map.put(line.substring(0, sepIndex), line.substring(sepIndex + 3)
.replace("\\n", "\n").replace("\\\n", "\\n"));
}
}

View File

@@ -127,10 +127,10 @@ abstract class StatusComp implements Posc, Flyingc{
return entry;
}
/** Uses a dynamic status effect to override speed. */
/** Uses a dynamic status effect to override speed (in tiles/second). */
public void statusSpeed(float speed){
//type.speed should never be 0
applyDynamicStatus().speedMultiplier = speed / type.speed;
applyDynamicStatus().speedMultiplier = speed / (type.speed * 60f / tilesize);
}
/** Uses a dynamic status effect to change damage. */