|
|
@@ -1,4 +1,5 @@
|
|
|
-using System.Collections;
|
|
|
+using System;
|
|
|
+using System.Collections;
|
|
|
using TMPro;
|
|
|
using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
@@ -20,6 +21,12 @@ public class UILocalizeScript : MonoBehaviour
|
|
|
mText = GetComponent<Text>();
|
|
|
mTextMeshProUGUI = GetComponent<TextMeshProUGUI>();
|
|
|
Inner_SetContent(m_key);
|
|
|
+ EventMgr.AddEventListener<int>(ECoreEventType.EID_LANGUAGE_CHANGE, OnLanguageChange);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnLanguageChange(CoreEvent<int> e)
|
|
|
+ {
|
|
|
+ Refresh();
|
|
|
}
|
|
|
|
|
|
void OnEnable()
|
|
|
@@ -44,7 +51,10 @@ public class UILocalizeScript : MonoBehaviour
|
|
|
Refresh();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ private void OnDestroy()
|
|
|
+ {
|
|
|
+ EventMgr.RemoveEventListener<int>(ECoreEventType.EID_LANGUAGE_CHANGE, OnLanguageChange);
|
|
|
+ }
|
|
|
public void OnChangeLang()
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(m_key))
|