Esempio n. 1
0
        private void LoadGeneralSettings()
        {
            bool isGeneralSettingsSet = false;

            if (PlayerPrefs.HasKey(GENERAL_SETTINGS_KEY))
            {
                try
                {
                    currentGeneralSettings = JsonUtility.FromJson <SettingsData.GeneralSettings>(PlayerPrefs.GetString(GENERAL_SETTINGS_KEY));
                    isGeneralSettingsSet   = true;
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);
                }
            }
            if (!isGeneralSettingsSet)
            {
                currentGeneralSettings = new SettingsData.GeneralSettings()
                {
                    sfxVolume        = 1,
                    mouseSensitivity = 0.2f
                };
            }
        }
Esempio n. 2
0
        public void LoadDefaultSettings()
        {
            autosettingsEnabled.Set(false);
            currentQualitySettings = qualitySettingsPreset.defaultPreset;
            currentGeneralSettings = GetDefaultGeneralSettings();

            ApplyQualitySettings(currentQualitySettings);
            ApplyGeneralSettings(currentGeneralSettings);
        }
Esempio n. 3
0
        public void ApplyGeneralSettings(SettingsData.GeneralSettings settings)
        {
            if (settings.Equals(currentGeneralSettings))
            {
                return;
            }

            currentGeneralSettings = settings;
            OnGeneralSettingsChanged?.Invoke(settings);
            autosettingsEnabled.Set(settings.autoqualityOn);
        }
Esempio n. 4
0
        private void LoadGeneralSettings()
        {
            currentGeneralSettings = GetDefaultGeneralSettings();

            if (PlayerPrefsUtils.HasKey(GENERAL_SETTINGS_KEY))
            {
                try
                {
                    object currentSetting = currentGeneralSettings;
                    JsonUtility.FromJsonOverwrite(PlayerPrefsUtils.GetString(GENERAL_SETTINGS_KEY), currentSetting);
                    currentGeneralSettings = (SettingsData.GeneralSettings)currentSetting;
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);
                }
            }
        }
Esempio n. 5
0
 public void ApplyGeneralSettings(SettingsData.GeneralSettings settings)
 {
     currentGeneralSettings = settings;
     OnGeneralSettingsChanged?.Invoke(settings);
 }