override protected void OnAwake() { base.OnAwake(); if (!reloadOnAwake) { IsReady = true; return; } IsReady = false; foreach (TextAsset languageFile in languageFiles) { XDocument languageXMLData = XDocument.Parse(languageFile.text); Language language = new Language(); language.languageID = int.Parse(languageXMLData.Element("Language").Attribute("ID").Value); language.languageString = languageXMLData.Element("Language").Attribute("LANG").Value; foreach (XElement textx in languageXMLData.Element("Language").Elements()) { TextKeyValue textKeyValue = new TextKeyValue(); textKeyValue.key = textx.Attribute("key").Value; textKeyValue.value = textx.Value; language.textKeyValueList.Add(textKeyValue); } languages.Add(language); } IsReady = true; }
private static LocalizationManager instance; // GameSystem local instance void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else if (instance != null) { Destroy(this); } // This will read each XML file from the languageFiles list<> and populate the languages list with the data foreach (TextAsset languageFile in languageFiles) { XDocument languageXMLData = XDocument.Parse(languageFile.text); Language language = new Language(); language.languageID = (GameData.LANG)System.Int32.Parse(languageXMLData.Element("Language").Attribute("ID").Value); language.languageString = languageXMLData.Element("Language").Attribute("LANG").Value; foreach (XElement textx in languageXMLData.Element("Language").Elements()) { TextKeyValue textKeyValue = new TextKeyValue(); textKeyValue.key = textx.Attribute("key").Value; textKeyValue.value = textx.Value; language.textKeyValueList.Add(textKeyValue); } languages.Add(language); } if (PersistantData.instance != null) { currentLanguageID = PersistantData.instance.data.Lang; } }
private static LocalizationManager instance; // GameSystem local instance void Awake() { //PlayerPrefs.DeleteAll(); //Debug.Log("시스템 언어 : " + Application.systemLanguage); if (Application.systemLanguage.ToString() == "Korean") { currentLanguageID = 1; } else { currentLanguageID = 0; } if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { if (this != instance) { Destroy(this.gameObject); } } // This will read each XML file from the languageFiles list<> and populate the languages list with the data foreach (TextAsset languageFile in languageFiles) { XDocument languageXMLData = XDocument.Parse(languageFile.text); Language language = new Language(); language.languageID = System.Int32.Parse(languageXMLData.Element("Language").Attribute("ID").Value); language.languageString = languageXMLData.Element("Language").Attribute("LANG").Value; foreach (XElement textx in languageXMLData.Element("Language").Elements()) { TextKeyValue textKeyValue = new TextKeyValue(); textKeyValue.key = textx.Attribute("key").Value; textKeyValue.value = textx.Value; language.textKeyValueList.Add(textKeyValue); } languages.Add(language); } }
void Awake() { currentLanguageID = PlayerPrefs.GetInt("language_id"); instance = this; DontDestroyOnLoad(this); // This will read each XML file from the languageFiles list<> and populate the languages list with the data foreach (TextAsset languageFile in languageFiles) { XDocument languageXMLData = XDocument.Parse(languageFile.text); Language language = new Language(); language.languageID = System.Int32.Parse(languageXMLData.Element("Language").Attribute("ID").Value); language.languageString = languageXMLData.Element("Language").Attribute("LANG").Value; foreach (XElement textx in languageXMLData.Element("Language").Elements()) { TextKeyValue textKeyValue = new TextKeyValue(); textKeyValue.key = textx.Attribute("key").Value; textKeyValue.value = textx.Value; language.textKeyValueList.Add(textKeyValue); } languages.Add(language); } }