| | |
| | | const string SOUND_VOLUME_KEY = "SoundRatioKey"; //音乐
|
| | | const string SOUND_EFFECT_KEY = "SoundEffect"; //音效
|
| | | const string FPS_KEY = "FPSKey";
|
| | | const string VSYNC_KEY = "GameVSyncCountSetting";//垂直同步率
|
| | |
|
| | | public Dictionary<SystemSwitch, bool> systemSettings = new Dictionary<SystemSwitch, bool>();
|
| | |
|
| | |
| | | public event Action<SystemSwitch, bool> OnSettingChanged;
|
| | | public event Action qualityLevelChangeEvent;
|
| | | public event Action playerSyncCountChangeEvent;
|
| | | public event Action vSyncCountChangeEvent;
|
| | |
|
| | | public SystemSetting()
|
| | | {
|
| | |
| | | public float GetSoundEffect()
|
| | | {
|
| | | return LocalSave.GetFloat(SOUND_EFFECT_KEY, 1);
|
| | | }
|
| | |
|
| | | public void SetVSyncCount(int _vSync)
|
| | | {
|
| | | LocalSave.SetInt(VSYNC_KEY, QualitySettings.vSyncCount = Mathf.Clamp(_vSync, 0, 2));
|
| | |
|
| | | if (vSyncCountChangeEvent != null)
|
| | | {
|
| | | vSyncCountChangeEvent();
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetVSyncCount()
|
| | | {
|
| | | return LocalSave.GetInt(VSYNC_KEY, 2);
|
| | | }
|
| | |
|
| | | public void SetSystemSettingSwitch(SystemSwitch type, bool _value)
|
| | |
| | | public void SetQualityLevel(GameQuality _quality, bool _disabeCamera = true)
|
| | | {
|
| | | LocalSave.SetInt(QUALITY_LEVEL_KEY, Mathf.Clamp((int)_quality, 0, 2));
|
| | | QualitySettings.SetQualityLevel((int)GameQuality.High);
|
| | |
|
| | | switch (_quality)
|
| | | {
|
| | |
| | | Shader.DisableKeyword("QUALITY_HGH");
|
| | | Shader.DisableKeyword("QUALITY_MED");
|
| | | Shader.EnableKeyword("QUALITY_LOW");
|
| | | SetVSyncCount(2);
|
| | | break;
|
| | | case GameQuality.Medium:
|
| | | Shader.globalMaximumLOD = 250;
|