| | |
| | | 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)
|
| | |
| | | var result = SettingMgr.Instance.GetAccountSetIntInfo("PlayerSyncCount");
|
| | | if (result == -1)
|
| | | {
|
| | | m_PlayerSyncCount = 15;
|
| | | var quality = GetCurrentQualityLevel();
|
| | | switch (quality)
|
| | | {
|
| | | case GameQuality.High:
|
| | | m_PlayerSyncCount = 15;
|
| | | break;
|
| | | case GameQuality.Low:
|
| | | m_PlayerSyncCount = 10;
|
| | | break;
|
| | | case GameQuality.Medium:
|
| | | m_PlayerSyncCount = 5;
|
| | | break;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | 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");
|
| | | PostProcessingUtility.TogglePostProcessing(false);
|
| | | SetVSyncCount(2);
|
| | | break;
|
| | | case GameQuality.Medium:
|
| | | Shader.globalMaximumLOD = 250;
|
| | | Shader.DisableKeyword("QUALITY_HGH");
|
| | | Shader.EnableKeyword("QUALITY_MED");
|
| | | Shader.DisableKeyword("QUALITY_LOW");
|
| | | PostProcessingUtility.TogglePostProcessing(false);
|
| | | break;
|
| | | case GameQuality.High:
|
| | | Shader.globalMaximumLOD = 500;
|
| | | Shader.EnableKeyword("QUALITY_HGH");
|
| | | Shader.DisableKeyword("QUALITY_MED");
|
| | | Shader.DisableKeyword("QUALITY_LOW");
|
| | | PostProcessingUtility.TogglePostProcessing(false);
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | //目前看起来所有的安卓机跑高效果都可以接受,先给玩家默认设置高效果。
|
| | | if (Application.platform == RuntimePlatform.Android)
|
| | | {
|
| | | return (GameQuality)LocalSave.GetInt(QUALITY_LEVEL_KEY, (int)GameQuality.High);
|
| | | if (!LocalSave.HasKey(QUALITY_LEVEL_KEY))
|
| | | {
|
| | | var defaultQuality = GameQuality.High;
|
| | |
|
| | | if (DeviceUtility.cpu >= 4 && DeviceUtility.memory > 3.5f * 1024)
|
| | | {
|
| | | defaultQuality = GameQuality.High;
|
| | | }
|
| | | else if (DeviceUtility.cpu >= 4 && DeviceUtility.memory > 2.5f * 1024)
|
| | | {
|
| | | defaultQuality = GameQuality.Medium; ;
|
| | | }
|
| | | else if (DeviceUtility.cpu > 1 && DeviceUtility.memory > 1.5f * 1024)
|
| | | {
|
| | | defaultQuality = GameQuality.Low;
|
| | | }
|
| | |
|
| | | return (GameQuality)LocalSave.GetInt(QUALITY_LEVEL_KEY, (int)defaultQuality);
|
| | | }
|
| | | else
|
| | | {
|
| | | return (GameQuality)LocalSave.GetInt(QUALITY_LEVEL_KEY);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|