From 03eaa4e24f62edf291f0b2d0624dfdde4a0ebac3 Mon Sep 17 00:00:00 2001
From: QD_LCJ <461730578@qq.com>
Date: 星期四, 09 八月 2018 15:43:07 +0800
Subject: [PATCH] 1518 【前端】日常宗门试练点击兑换打开界面默认选择了5阶兑换
---
System/SystemSetting/SystemSetting.cs | 438 +++++++++++++++++++++++++++---------------------------
1 files changed, 219 insertions(+), 219 deletions(-)
diff --git a/System/SystemSetting/SystemSetting.cs b/System/SystemSetting/SystemSetting.cs
index 73567f4..c4d0174 100644
--- a/System/SystemSetting/SystemSetting.cs
+++ b/System/SystemSetting/SystemSetting.cs
@@ -1,220 +1,220 @@
-锘縰sing System.Collections.Generic;
-using System.Text;
-using UnityEngine;
-using UnityEngine.Events;
-using System;
-using Snxxz.UI;
-using System.Collections;
-
-public class SystemSetting : Singleton<SystemSetting>
-{
- const string QUALITY_LEVEL_KEY = "GameQualityLevel";
- const string SOUND_VOLUME_KEY = "SoundRatioKey"; //闊充箰
- const string SOUND_EFFECT_KEY = "SoundEffect"; //闊虫晥
- const string FPS_KEY = "FPSKey";
-
- public Dictionary<SystemSwitch, bool> systemSettings = new Dictionary<SystemSwitch, bool>();
-
- int m_PlayerSyncCount = -1;
-
- public event Action<SystemSwitch, bool> OnSettingChanged;
- public event Action qualityLevelChangeEvent;
- public event Action playerSyncCountChangeEvent;
-
- public SystemSetting()
- {
- DTC0102_tagCDBPlayer.switchAccountEvent += OnSwitchAccount;
- }
-
- ~SystemSetting()
- {
- DTC0102_tagCDBPlayer.switchAccountEvent -= OnSwitchAccount;
- }
-
- public void SetSoundVolume(float _volume)
- {
- LocalSave.SetFloat(SOUND_VOLUME_KEY, Mathf.Clamp01(_volume));
- SoundPlayer.Instance.musicAudioSource.volume = Mathf.Clamp01(_volume);
- }
-
- public float GetSoundVolume()
- {
- return LocalSave.GetFloat(SOUND_VOLUME_KEY, 1);
- }
-
- public void SetSoundEffect(float value)
- {
- LocalSave.SetFloat(SOUND_EFFECT_KEY, Mathf.Clamp01(value));
- }
-
- public float GetSoundEffect()
- {
- return LocalSave.GetFloat(SOUND_EFFECT_KEY, 1);
- }
-
- public void SetSystemSettingSwitch(SystemSwitch type, bool _value)
- {
- SettingMgr.Instance.SetAccountSetStr(type.ToString(), _value.ToString());
- systemSettings[type] = _value;
-
- if (OnSettingChanged != null)
- {
- OnSettingChanged(type, _value);
- }
- }
-
- public bool GetSystemSettingSwitch(SystemSwitch type)
- {
- if (systemSettings.ContainsKey(type))
- {
- return systemSettings[type];
- }
- else
- {
- return systemSettings[type] = SettingMgr.Instance.GetAccountSetBoolInfo(type.ToString()); ;
- }
- }
-
- public void SetPlayerSyncCount(int _syncCount)
- {
- SettingMgr.Instance.SetAccountSetStr("PlayerSyncCount", _syncCount.ToString());
-
- if (m_PlayerSyncCount != _syncCount)
- {
- m_PlayerSyncCount = _syncCount;
- if (playerSyncCountChangeEvent != null)
- {
- playerSyncCountChangeEvent();
- }
- }
- }
-
- public int GetPlayerSyncCount()
- {
- if (m_PlayerSyncCount == -1)
- {
- var result = SettingMgr.Instance.GetAccountSetIntInfo("PlayerSyncCount");
- if (result == -1)
- {
- m_PlayerSyncCount = 15;
- }
- else
- {
- m_PlayerSyncCount = Mathf.Clamp(result, 0, 20);
- }
- }
-
- return m_PlayerSyncCount;
- }
-
- 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)
- {
- case GameQuality.Low:
- Shader.globalMaximumLOD = 250;
- Shader.DisableKeyword("QUALITY_HGH");
- Shader.DisableKeyword("QUALITY_MED");
- Shader.EnableKeyword("QUALITY_LOW");
- PostProcessingUtility.TogglePostProcessing(false);
- 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 UNITY_ANDROID && !UNITY_EDITOR
- if (_disabeCamera)
- {
- CameraManager.uiCamera.enabled = false;
- }
-
- ResolutionUtility.AdjustResolution(_quality);
- if (_disabeCamera)
- {
- SnxxzGame.Instance.StartCoroutine(Co_WaitFewMinute());
- }
-#endif
-
- if (qualityLevelChangeEvent != null)
- {
- qualityLevelChangeEvent();
- }
-
- }
-
- public GameQuality GetCurrentQualityLevel()
- {
- //鐩墠鐪嬭捣鏉ユ墍鏈夌殑瀹夊崜鏈鸿窇楂樻晥鏋滈兘鍙互鎺ュ彈锛屽厛缁欑帺瀹堕粯璁よ缃珮鏁堟灉銆�
- if (Application.platform == RuntimePlatform.Android)
- {
- return (GameQuality)LocalSave.GetInt(QUALITY_LEVEL_KEY, (int)GameQuality.High);
- }
- else
- {
- return (GameQuality)LocalSave.GetInt(QUALITY_LEVEL_KEY, (int)GameQuality.High);
- }
- }
-
- public void SetFPSLimit(int _fps)
- {
- LocalSave.SetInt(FPS_KEY, Application.targetFrameRate = Mathf.Clamp(_fps, 30, 60));
- }
-
- public int GetFPSLimit()
- {
- return LocalSave.GetInt(FPS_KEY, 30);
- }
-
- public void LetFPSUnLimit()
- {
- Application.targetFrameRate = 1000;
- }
-
- private void OnSwitchAccount()
- {
- systemSettings.Clear();
- m_PlayerSyncCount = -1;
- }
-
- IEnumerator Co_WaitFewMinute()
- {
- yield return WaitingForSecondConst.WaitMS500;
- CameraManager.uiCamera.enabled = true;
- }
-}
-
-public enum SystemSwitch
-{
- OtherPlayer, //鏄惁鏄剧ず鍏朵粬鐜╁
- HideMonster, //鏄惁鏄剧ず鏅�氬皬鎬�
-}
-
-public enum PlayerSyncCount
-{
- None,
- Five = 5,
- Ten = 10,
- Fifteen = 15,
-}
-
-public enum GameQuality
-{
- Low = 0,
- Medium = 1,
- High = 2,
+锘縰sing System.Collections.Generic;
+using System.Text;
+using UnityEngine;
+using UnityEngine.Events;
+using System;
+using Snxxz.UI;
+using System.Collections;
+
+public class SystemSetting : Singleton<SystemSetting>
+{
+ const string QUALITY_LEVEL_KEY = "GameQualityLevel";
+ const string SOUND_VOLUME_KEY = "SoundRatioKey"; //闊充箰
+ const string SOUND_EFFECT_KEY = "SoundEffect"; //闊虫晥
+ const string FPS_KEY = "FPSKey";
+
+ public Dictionary<SystemSwitch, bool> systemSettings = new Dictionary<SystemSwitch, bool>();
+
+ int m_PlayerSyncCount = -1;
+
+ public event Action<SystemSwitch, bool> OnSettingChanged;
+ public event Action qualityLevelChangeEvent;
+ public event Action playerSyncCountChangeEvent;
+
+ public SystemSetting()
+ {
+ DTC0102_tagCDBPlayer.switchAccountEvent += OnSwitchAccount;
+ }
+
+ ~SystemSetting()
+ {
+ DTC0102_tagCDBPlayer.switchAccountEvent -= OnSwitchAccount;
+ }
+
+ public void SetSoundVolume(float _volume)
+ {
+ LocalSave.SetFloat(SOUND_VOLUME_KEY, Mathf.Clamp01(_volume));
+ SoundPlayer.Instance.musicAudioSource.volume = Mathf.Clamp01(_volume);
+ }
+
+ public float GetSoundVolume()
+ {
+ return LocalSave.GetFloat(SOUND_VOLUME_KEY, 1);
+ }
+
+ public void SetSoundEffect(float value)
+ {
+ LocalSave.SetFloat(SOUND_EFFECT_KEY, Mathf.Clamp01(value));
+ }
+
+ public float GetSoundEffect()
+ {
+ return LocalSave.GetFloat(SOUND_EFFECT_KEY, 1);
+ }
+
+ public void SetSystemSettingSwitch(SystemSwitch type, bool _value)
+ {
+ SettingMgr.Instance.SetAccountSetStr(type.ToString(), _value.ToString());
+ systemSettings[type] = _value;
+
+ if (OnSettingChanged != null)
+ {
+ OnSettingChanged(type, _value);
+ }
+ }
+
+ public bool GetSystemSettingSwitch(SystemSwitch type)
+ {
+ if (systemSettings.ContainsKey(type))
+ {
+ return systemSettings[type];
+ }
+ else
+ {
+ return systemSettings[type] = SettingMgr.Instance.GetAccountSetBoolInfo(type.ToString()); ;
+ }
+ }
+
+ public void SetPlayerSyncCount(int _syncCount)
+ {
+ SettingMgr.Instance.SetAccountSetStr("PlayerSyncCount", _syncCount.ToString());
+
+ if (m_PlayerSyncCount != _syncCount)
+ {
+ m_PlayerSyncCount = _syncCount;
+ if (playerSyncCountChangeEvent != null)
+ {
+ playerSyncCountChangeEvent();
+ }
+ }
+ }
+
+ public int GetPlayerSyncCount()
+ {
+ if (m_PlayerSyncCount == -1)
+ {
+ var result = SettingMgr.Instance.GetAccountSetIntInfo("PlayerSyncCount");
+ if (result == -1)
+ {
+ m_PlayerSyncCount = 15;
+ }
+ else
+ {
+ m_PlayerSyncCount = Mathf.Clamp(result, 0, 20);
+ }
+ }
+
+ return m_PlayerSyncCount;
+ }
+
+ 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)
+ {
+ case GameQuality.Low:
+ Shader.globalMaximumLOD = 250;
+ Shader.DisableKeyword("QUALITY_HGH");
+ Shader.DisableKeyword("QUALITY_MED");
+ Shader.EnableKeyword("QUALITY_LOW");
+ PostProcessingUtility.TogglePostProcessing(false);
+ 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 UNITY_ANDROID && !UNITY_EDITOR
+ if (_disabeCamera)
+ {
+ CameraManager.uiCamera.enabled = false;
+ }
+
+ ResolutionUtility.AdjustResolution(_quality);
+ if (_disabeCamera)
+ {
+ SnxxzGame.Instance.StartCoroutine(Co_WaitFewMinute());
+ }
+#endif
+
+ if (qualityLevelChangeEvent != null)
+ {
+ qualityLevelChangeEvent();
+ }
+
+ }
+
+ public GameQuality GetCurrentQualityLevel()
+ {
+ //鐩墠鐪嬭捣鏉ユ墍鏈夌殑瀹夊崜鏈鸿窇楂樻晥鏋滈兘鍙互鎺ュ彈锛屽厛缁欑帺瀹堕粯璁よ缃珮鏁堟灉銆�
+ if (Application.platform == RuntimePlatform.Android)
+ {
+ return (GameQuality)LocalSave.GetInt(QUALITY_LEVEL_KEY, (int)GameQuality.High);
+ }
+ else
+ {
+ return (GameQuality)LocalSave.GetInt(QUALITY_LEVEL_KEY, (int)GameQuality.High);
+ }
+ }
+
+ public void SetFPSLimit(int _fps)
+ {
+ LocalSave.SetInt(FPS_KEY, Application.targetFrameRate = Mathf.Clamp(_fps, 30, 60));
+ }
+
+ public int GetFPSLimit()
+ {
+ return LocalSave.GetInt(FPS_KEY, 30);
+ }
+
+ public void LetFPSUnLimit()
+ {
+ Application.targetFrameRate = 1000;
+ }
+
+ private void OnSwitchAccount()
+ {
+ systemSettings.Clear();
+ m_PlayerSyncCount = -1;
+ }
+
+ IEnumerator Co_WaitFewMinute()
+ {
+ yield return WaitingForSecondConst.WaitMS500;
+ CameraManager.uiCamera.enabled = true;
+ }
+}
+
+public enum SystemSwitch
+{
+ OtherPlayer, //鏄惁鏄剧ず鍏朵粬鐜╁
+ HideMonster, //鏄惁鏄剧ず鏅�氬皬鎬�
+}
+
+public enum PlayerSyncCount
+{
+ None,
+ Five = 5,
+ Ten = 10,
+ Fifteen = 15,
+}
+
+public enum GameQuality
+{
+ Low = 0,
+ Medium = 1,
+ High = 2,
}
\ No newline at end of file
--
Gitblit v1.8.0