protected override void Start() { AutoLanguage instance = AutoLanguage.instance; instance.onTextChanged = (AutoLanguage.OnTextChanged)Delegate.Combine(instance.onTextChanged, new AutoLanguage.OnTextChanged(setText)); setText(); }
private void Awake() { if (instance == null) { instance = this; LanguageScript.ParseStrings(); if (Application.isPlaying) { UnityEngine.Object.DontDestroyOnLoad(base.gameObject); } } else { UnityEngine.Object.Destroy(base.gameObject); } }
public static void ParseStrings() { try { AutoLanguage.Inıt(); } catch (Exception) { } JsonData jsonData = new JsonData(); try { string path = "LangFiles/" + PlayerPrefsManager.GetLang().ToLower(); TextAsset textAsset = Resources.Load <TextAsset>(path); jsonData = JsonMapper.ToObject(textAsset.text); } catch (Exception) { } for (int i = 0; i < jsonData.Count; i++) { try { Type typeFromHandle = typeof(LanguageScript); FieldInfo field = typeFromHandle.GetField(jsonData[i]["Key"].ToString().Trim()); field.SetValue(null, jsonData[i]["Value"].ToString()); } catch (Exception) { } try { AutoLanguage.dict.Add(jsonData[i]["Key"].ToString().Trim(), AutoLanguage.CorretArabic(jsonData[i]["Value"].ToString())); } catch (Exception) { } } try { AutoLanguage.instance.onTextChanged(); } catch (Exception) { } }