Formatting Icons (#10359)

* formatIcons

* Smarter end check

I think it's smarter?

* unecessary

* oop

* Update UI.java

* Just don't check for adjacent colons.

The hasUnicodeStr already checks for validity

* Copy from I18NBundle

* Revert "Copy from I18NBundle"

This reverts commit ac660fcd9f.

* If get and format refer to parent, then just set the existing bundle as parent

* Test with Ground Zero objectives

* Update MBundle.java

* That didn't work

* Slip the method into reasonable places like objectives and chat

* Check for Icons as well

* More testing with objective text

* Apply to hints

* Optimized formatIcons

No longer scans through every character

* TIME UPDATE THE BUNDLES YIPPEEEEEEEEEEE

* residual

* Apply to message blocks

* IntelliJ lied

* Suggestions

* Format before sending
This commit is contained in:
MEEPofFaith
2025-02-08 21:05:43 -08:00
committed by GitHub
parent aaf335d06c
commit e8a4ecc61e
31 changed files with 984 additions and 939 deletions

View File

@@ -14,6 +14,7 @@ import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.core.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.input.*;
@@ -161,14 +162,15 @@ public class ChatFragment extends Table{
float theight = offsety + spacing + getMarginBottom() + scene.marginBottom;
for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos && (i < fadetime || shown); i++){
String message = messages.get(i);
layout.setText(font, messages.get(i), Color.white, textWidth, Align.bottomLeft, true);
layout.setText(font, message, Color.white, textWidth, Align.bottomLeft, true);
theight += layout.height + textspacing;
if(i - scrollPos == 0) theight -= textspacing + 1;
font.getCache().clear();
font.getCache().setColor(Color.white);
font.getCache().addText(messages.get(i), fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true);
font.getCache().addText(message, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true);
if(!shown && fadetime - i < 1f && fadetime - i >= 0f){
font.getCache().setAlphas((fadetime - i) * opacity);
@@ -200,6 +202,8 @@ public class ChatFragment extends Table{
history.insert(1, message);
message = UI.formatIcons(message);
Events.fire(new ClientChatEvent(message));
Call.sendChatMessage(message);

View File

@@ -13,6 +13,7 @@ import arc.util.*;
import mindustry.*;
import mindustry.ai.types.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
@@ -250,7 +251,7 @@ public class HintsFragment{
text = Vars.mobile && Core.bundle.has("hint." + name() + ".mobile") ? Core.bundle.get("hint." + name() + ".mobile") : Core.bundle.get("hint." + name());
if(!Vars.mobile) text = text.replace("tap", "click").replace("Tap", "Click");
}
return text;
return UI.formatIcons(text);
}
@Override