中文版本
This commit is contained in:
1 parent
8e88b4adba
commit
51834b709c
85 files changed
+12545
-4847
No files matched your search
@@ -11,6 +11,7 @@ namespace Assets.Scripts.UI.Control
|
||||
[RequireComponent(typeof(Text))]
|
||||
public class PFUIText : PFUIComponentBase
|
||||
{
|
||||
public string key;
|
||||
private Text text;
|
||||
|
||||
public string Text
|
||||
@@ -27,6 +28,28 @@ namespace Assets.Scripts.UI.Control
|
||||
protected void Awake()
|
||||
{
|
||||
text = this.transform.GetComponent<Text>();
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
key = text.text;//默认英文内容为key值
|
||||
}
|
||||
}
|
||||
protected void Start()
|
||||
{
|
||||
Debug.Log(text.text);
|
||||
if (App.LanguageManager != null && App.LanguageManager.ContainsKey(key))
|
||||
{
|
||||
Debug.Log(text.text);
|
||||
text.text = App.LanguageManager[key];
|
||||
}
|
||||
App.ChangeLanguageEvent += App_ChangeLanguageEvent;
|
||||
}
|
||||
|
||||
private void App_ChangeLanguageEvent()
|
||||
{
|
||||
if (App.LanguageManager != null && App.LanguageManager.ContainsKey(text.text))
|
||||
{
|
||||
text.text = App.LanguageManager[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user