using I2.Loc; using UnityEngine; using UnityEngine.UI; public class FixLineBreaks : MonoBehaviour { public Text text; public bool ja = true; public bool zh = true; private void OnEnable() { if (text == null) { text = GetComponent(); } Fix(); } public void Fix() { if (!(text == null)) { if (ja && LocalizationManager.CurrentLanguageCode == "ja") { text.text = text.text.Replace("。 ", "。"); text.text = text.text.Replace("、 ", "、"); text.text = text.text.Replace("・ ", "・"); text.text = text.text.Replace("! ", "!"); text.text = text.text.Replace("。", "。 "); text.text = text.text.Replace("、", "、 "); text.text = text.text.Replace("・", "・ "); text.text = text.text.Replace("!", "! "); } else if (zh && LocalizationManager.CurrentLanguageCode == "zh") { text.text = text.text.Replace("。 ", "。"); text.text = text.text.Replace(", ", ","); text.text = text.text.Replace("・ ", "・"); text.text = text.text.Replace("! ", "!"); text.text = text.text.Replace("。", "。 "); text.text = text.text.Replace(",", ", "); text.text = text.text.Replace("・", "・ "); text.text = text.text.Replace("!", "! "); } } } }