private void OnOKBtn(GameObject go) { string str = optionWnd.Find("LanguageSelect/CurLanguage").GetComponent <UILabel>().text; int index = 0; switch (str) { case "中文": GameApp.curLanguage = LanguageType.Chinese; index = 1; break; case "English": GameApp.curLanguage = LanguageType.English; index = 2; break; case "Japanese": GameApp.curLanguage = LanguageType.Japanese; index = 3; break; } PlayerPrefs.SetInt("Language", index); UILabel[] labelList = GameObject.Find("UI Root (3D)").GetComponentsInChildren <UILabel>(); foreach (UILabel u in labelList) { if (u.transform.GetComponent <SetLanguage>()) { GameApp.SetText(u.transform, TableLanguage.GetInstance().GetIdByText(u.text)); } } optionWnd.gameObject.SetActive(false); }
public void Load() { TableAchievement.GetInstance().Read(); TableEnemy.GetInstance().Read(); TableLanguage.GetInstance().Read(); TableParts.GetInstance().Read(); xjlFont = Resources.Load <UIFont>("Font/xjlFont"); jpFont = Resources.Load <UIFont>("Font/jpFont"); BackgroundAtlas = Resources.Load <UIAtlas>("Background/Background"); EnemyAtlas = Resources.Load <UIAtlas>("Enemy/Enemy"); PartsAtlas = Resources.Load <UIAtlas>("Parts/Parts"); UiAtlas = Resources.Load <UIAtlas>("UI/UI"); Debug.Log("ResourceLoadDone!"); }
internal static void SetText(Transform transform, int ID, LanguageType type) { if (type == LanguageType.Chinese) { transform.GetComponent <UILabel>().font = ResourceLoad.GetInstance().xjlFont; transform.GetComponent <UILabel>().text = TableLanguage.GetInstance().GetTextById(ID, type); } else if (type == LanguageType.English) { transform.GetComponent <UILabel>().font = ResourceLoad.GetInstance().xjlFont; transform.GetComponent <UILabel>().text = TableLanguage.GetInstance().GetTextById(ID, type); } else if (type == LanguageType.Japanese) { transform.GetComponent <UILabel>().font = ResourceLoad.GetInstance().jpFont; transform.GetComponent <UILabel>().text = TableLanguage.GetInstance().GetTextById(ID, type); } }