Files
2026-02-21 16:45:37 +08:00

51 lines
1.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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<Text>();
}
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("", " ");
}
}
}
}