Пример #1
0
        public void Awake()
        {
            Audio = GetComponent <Audio>();
            Localization_SOURCE = GetComponent <Localization_SOURCE>();

            if (PlayerPrefs.HasKey("mouseSensivity"))
            {
                mouseSensivity = PlayerPrefs.GetFloat("mouseSensivity");
            }
            else
            {
                mouseSensivity = 0.4f;
                PlayerPrefs.SetFloat("mouseSensivity", mouseSensivity);
            }

            if (PlayerPrefs.HasKey("musiqueVolume"))
            {
                Audio.musicVolume = PlayerPrefs.GetFloat("musiqueVolume");
            }
            else
            {
                Audio.musicVolume = 0.5f;
                PlayerPrefs.SetFloat("musiqueVolume", Audio.musicVolume);
            }

            if (PlayerPrefs.HasKey("sfxVolume"))
            {
                Audio.sfxVolume = PlayerPrefs.GetFloat("sfxVolume");
            }
            else
            {
                Audio.sfxVolume = 0.5f;
                PlayerPrefs.SetFloat("sfxVolume", Audio.sfxVolume);
            }

            if (language && PlayerPrefs.HasKey("language"))
            {
                language.value = PlayerPrefs.GetInt("language");
                lang           = PlayerPrefs.GetInt("language");
                Localization_SOURCE.PUBLIC_LoadLanguage(language.value);
            }
            else if (language)
            {
                PlayerPrefs.SetInt("language", language.value);
            }

            if (Pseudo && PlayerPrefs.HasKey("pseudo"))
            {
                Pseudo.text = PlayerPrefs.GetString("pseudo");
            }
            else if (Pseudo)
            {
                OnRandomPseudo();
            }

            PlayerPrefs.Save();
        }
Пример #2
0
        public void OnLanguageChange(int val)
        {
            Localization_SOURCE.PUBLIC_LoadLanguage(val);
            PlayerPrefs.SetInt("language", val);
            lang = val;

            if (PlayerPrefs.HasKey("pseudo") && Regex.IsMatch(Pseudo.text, "Su[b]{0,1}je[c]{0,1}t\\d{4}"))
            {
                OnRandomPseudo();
            }
            PlayerPrefs.Save();
        }