public static void ChangeLang(LangCode lang) { if (lang == Localizator.lang) { return; } MyPlayerPrefs.SetString(key, lang.ToString()); Localizator.lang = lang; OnLangChanged(); Debug.Log($"Change language: {lang}"); }
void Write() { int dataInt = 5; MyPlayerPrefs.SetInt("SimpleInt", dataInt); float dataFloat = 0.5f; MyPlayerPrefs.SetFloat("SimpleFloat", dataFloat); string dataString = "Saved data atata"; MyPlayerPrefs.SetString("SimpleString", dataString); Vector3 dataVector = new Vector3(0.5f, 0.5f, 1f); MyPlayerPrefs.SetVector3("SimpleVector", dataVector); Quaternion dataQuat = new Quaternion(1f, 2f, 3f, 4f); MyPlayerPrefs.SetQuaternion("SimpleQuat", dataQuat); Color dataColor = new Color(1f, 1f, 1f, 1f); MyPlayerPrefs.SetColor("SimpleColor", dataColor); Debug.LogWarning("WRITED"); }
static void LoadLang() { LangCode lt; string l = MyPlayerPrefs.GetString(key, null); if (l == null) { var sl = Application.systemLanguage; if (!LocData.TryGetCode(sl, out lt)) { lt = LangCode.en; } } else { if (!LocData.TryParseCode(l, out lt)) { lt = LangCode.en; } } MyPlayerPrefs.SetString(key, lt.ToString()); MyLogger.LogFormat("Localization: {0}", lt); lang = lt; }