51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
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("!", "! ");
|
||
}
|
||
}
|
||
}
|
||
}
|