Exemplo n.º 1
0
        public void Read4PlayerPrefs()
        {
            string setting = PlayerPrefs.GetString("SystemSetting");

            if (string.IsNullOrEmpty(setting))
            {
                QualitySettings.vSyncCount         = 0;
                QualitySettings.antiAliasing       = 4;
                QualitySettings.masterTextureLimit = 3;
                QualitySettings.shadows            = ShadowQuality.All;
                QualitySettings.shadowResolution   = ShadowResolution.High;
                QualitySettings.shadowDistance     = 150;
                return;
            }
            SettingRecord record = SimpleJson.SimpleJson.DeserializeObject <SettingRecord>(setting);

            Screen.fullScreen = record.fullScreen;
            Screen.SetResolution(record.resolution.width, record.resolution.height, Screen.fullScreen);
            QualitySettings.vSyncCount         = record.vSyncCount;
            QualitySettings.antiAliasing       = antiAliasingSetting[record.antiAliasing];
            QualitySettings.masterTextureLimit = record.masterTextureLimit;
            QualitySettings.shadows            = (ShadowQuality)record.shadowQuality;
            QualitySettings.shadowResolution   = (ShadowResolution)record.shadowResolution;
            QualitySettings.shadowDistance     = shadowDistances[record.shadowDistance];
        }
Exemplo n.º 2
0
        public void Write2PlayerPrefs()
        {
            SettingRecord settingRecord = new SettingRecord();

            settingRecord.fullScreen = Screen.fullScreen;
            settingRecord.resolution = new ScreenResolution()
            {
                width = Screen.width, height = Screen.height
            };
            settingRecord.vSyncCount         = QualitySettings.vSyncCount;
            settingRecord.antiAliasing       = antiAliasing;
            settingRecord.masterTextureLimit = QualitySettings.masterTextureLimit;
            settingRecord.shadowQuality      = (int)QualitySettings.shadows;
            settingRecord.shadowResolution   = (int)QualitySettings.shadowResolution;
            settingRecord.shadowDistance     = shadowDistanceIndex;
            string setting = SimpleJson.SimpleJson.SerializeObject(settingRecord);

            PlayerPrefs.SetString("SystemSetting", setting);
        }