Label localization support
This commit is contained in:
@@ -236,6 +236,9 @@ public class MapObjectives{
|
|||||||
public int sides = 4;
|
public int sides = 4;
|
||||||
public Color color = Pal.accent;
|
public Color color = Pal.accent;
|
||||||
|
|
||||||
|
//cached localized text
|
||||||
|
private transient String fetchedText;
|
||||||
|
|
||||||
public ShapeTextMarker(String text, float x, float y){
|
public ShapeTextMarker(String text, float x, float y){
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@@ -278,6 +281,10 @@ public class MapObjectives{
|
|||||||
Lines.poly(x, y, sides, radius + 1f, rotation);
|
Lines.poly(x, y, sides, radius + 1f, rotation);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
|
if(fetchedText == null){
|
||||||
|
fetchedText = text.startsWith("@") ? Core.bundle.get(text.substring(1)) : text;
|
||||||
|
}
|
||||||
|
|
||||||
WorldLabel.drawAt(text, x, y + radius + textHeight, Draw.z(), flags, fontSize);
|
WorldLabel.drawAt(text, x, y + radius + textHeight, Draw.z(), flags, fontSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,6 +325,8 @@ public class MapObjectives{
|
|||||||
public String text = "uwu";
|
public String text = "uwu";
|
||||||
public float x, y, fontSize = 1f;
|
public float x, y, fontSize = 1f;
|
||||||
public byte flags = WorldLabel.flagBackground | WorldLabel.flagOutline;
|
public byte flags = WorldLabel.flagBackground | WorldLabel.flagOutline;
|
||||||
|
//cached localized text
|
||||||
|
private transient String fetchedText;
|
||||||
|
|
||||||
public TextMarker(String text, float x, float y, float fontSize, byte flags){
|
public TextMarker(String text, float x, float y, float fontSize, byte flags){
|
||||||
this.text = text;
|
this.text = text;
|
||||||
@@ -338,7 +347,11 @@ public class MapObjectives{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
WorldLabel.drawAt(text, x, y, Draw.z(), flags, fontSize);
|
if(fetchedText == null){
|
||||||
|
fetchedText = text.startsWith("@") ? Core.bundle.get(text.substring(1)) : text;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldLabel.drawAt(fetchedText, x, y, Draw.z(), flags, fontSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -824,9 +824,10 @@ public class HudFragment{
|
|||||||
table.clicked(() -> {
|
table.clicked(() -> {
|
||||||
if(state.rules.objectives.size > 0){
|
if(state.rules.objectives.size > 0){
|
||||||
var first = state.rules.objectives.first();
|
var first = state.rules.objectives.first();
|
||||||
if(first.details() != null){
|
var details = first.details();
|
||||||
|
if(details != null){
|
||||||
//TODO this could be much better.
|
//TODO this could be much better.
|
||||||
ui.showInfo(first.details);
|
ui.showInfo(details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user