| | |
| | | const string QUALITY_LEVEL_KEY = "GameQualityLevel";
|
| | | const string SOUND_VOLUME_KEY = "SoundRatioKey"; //音乐
|
| | | const string SOUND_EFFECT_KEY = "SoundEffect"; //音效
|
| | | const string FPS_KEY = "FPSKey";
|
| | | const string GAMEFRAME_KEY = "GameFrameSetting";//垂直同步率
|
| | |
|
| | | public Dictionary<SystemSwitch, bool> systemSettings = new Dictionary<SystemSwitch, bool>();
|
| | |
| | | return LocalSave.GetFloat(SOUND_EFFECT_KEY, 1);
|
| | | }
|
| | |
|
| | | public void SetGameFrame(GameFrame _frame)
|
| | | public void SetGameFps(GameFps _frame)
|
| | | {
|
| | | LocalSave.SetInt(GAMEFRAME_KEY, (int)_frame);
|
| | | switch (_frame)
|
| | | {
|
| | | case GameFrame.FullFrame:
|
| | | SetFPSLimit(60);
|
| | | break;
|
| | | case GameFrame.HalfFrame:
|
| | | SetFPSLimit(30);
|
| | | break;
|
| | | }
|
| | |
|
| | | Application.targetFrameRate = Mathf.Clamp((int)_frame, 30, 60);
|
| | | if (gameFrameChangeEvent != null)
|
| | | {
|
| | | gameFrameChangeEvent();
|
| | | }
|
| | | }
|
| | |
|
| | | public GameFrame GetGameFrame()
|
| | | public GameFps GetGameFps()
|
| | | {
|
| | | return (GameFrame)LocalSave.GetInt(GAMEFRAME_KEY, (int)GameFrame.HalfFrame);
|
| | | return (GameFps)LocalSave.GetInt(GAMEFRAME_KEY, (int)GameFps.Full);
|
| | | }
|
| | |
|
| | | public void SetSystemSettingSwitch(SystemSwitch type, bool _value)
|
| | |
| | | {
|
| | | 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;
|
| | | }
|
| | | // 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);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void SetFPSLimit(int _fps)
|
| | | {
|
| | | Application.targetFrameRate = Mathf.Clamp(_fps, 30, 60);
|
| | | }
|
| | |
|
| | | public int GetFPSLimit()
|
| | | {
|
| | | switch (GetGameFrame())
|
| | | {
|
| | | case GameFrame.HalfFrame:
|
| | | return 30;
|
| | | case GameFrame.FullFrame:
|
| | | return 60;
|
| | | default:
|
| | | return 30;
|
| | | }
|
| | | }
|
| | |
|
| | | public void LetFPSUnLimit()
|
| | | {
|
| | |
| | | {
|
| | | systemSettings.Clear();
|
| | | m_PlayerSyncCount = -1;
|
| | | }
|
| | |
|
| | | private GameFps GetRecommendFps()
|
| | | {
|
| | | if (Screen.width * Screen.height > (1920 * 1080 + 10000))
|
| | | {
|
| | | return GameFps.Half;
|
| | | }
|
| | | else
|
| | | {
|
| | | return GameFps.Full;
|
| | | }
|
| | | }
|
| | |
|
| | | IEnumerator Co_WaitFewMinute()
|
| | |
| | | High = 2,
|
| | | }
|
| | |
|
| | | public enum GameFrame
|
| | | public enum GameFps
|
| | | {
|
| | | Free = 0,
|
| | | HalfFrame = 1,
|
| | | FullFrame = 2,
|
| | | Free = -1,
|
| | | Half = 30,
|
| | | Full = 60,
|
| | | } |