From f237dce65b7eb454dfc9e2fe6c8efdebca085b4e Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期二, 11 九月 2018 14:13:07 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/SystemSetting/SystemSetting.cs |   74 +++++++++++++++++++++----------------
 1 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/System/SystemSetting/SystemSetting.cs b/System/SystemSetting/SystemSetting.cs
index bb1fc38..866daa4 100644
--- a/System/SystemSetting/SystemSetting.cs
+++ b/System/SystemSetting/SystemSetting.cs
@@ -11,8 +11,7 @@
     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 VSYNC_KEY = "GameVSyncCountSetting";//鍨傜洿鍚屾鐜�
+    const string GAMEFRAME_KEY = "GameFrameSetting";//鍨傜洿鍚屾鐜�
 
     public Dictionary<SystemSwitch, bool> systemSettings = new Dictionary<SystemSwitch, bool>();
 
@@ -21,7 +20,7 @@
     public event Action<SystemSwitch, bool> OnSettingChanged;
     public event Action qualityLevelChangeEvent;
     public event Action playerSyncCountChangeEvent;
-    public event Action vSyncCountChangeEvent;
+    public event Action gameFrameChangeEvent;
 
     public SystemSetting()
     {
@@ -54,19 +53,19 @@
         return LocalSave.GetFloat(SOUND_EFFECT_KEY, 1);
     }
 
-    public void SetVSyncCount(int _vSync)
+    public void SetGameFps(GameFps _frame)
     {
-        LocalSave.SetInt(VSYNC_KEY, QualitySettings.vSyncCount = Mathf.Clamp(_vSync, 0, 2));
-
-        if (vSyncCountChangeEvent != null)
+        LocalSave.SetInt(GAMEFRAME_KEY, (int)_frame);
+        Application.targetFrameRate = Mathf.Clamp((int)_frame, 30, 60);
+        if (gameFrameChangeEvent != null)
         {
-            vSyncCountChangeEvent();
+            gameFrameChangeEvent();
         }
     }
 
-    public int GetVSyncCount()
+    public GameFps GetGameFps()
     {
-        return LocalSave.GetInt(VSYNC_KEY, 2);
+        return (GameFps)LocalSave.GetInt(GAMEFRAME_KEY, (int)GameFps.Full);
     }
 
     public void SetSystemSettingSwitch(SystemSwitch type, bool _value)
@@ -143,13 +142,13 @@
         switch (_quality)
         {
             case GameQuality.Low:
-                Shader.globalMaximumLOD = 250;
+                Shader.globalMaximumLOD = 300;
                 Shader.DisableKeyword("QUALITY_HGH");
                 Shader.DisableKeyword("QUALITY_MED");
                 Shader.EnableKeyword("QUALITY_LOW");
                 break;
             case GameQuality.Medium:
-                Shader.globalMaximumLOD = 250;
+                Shader.globalMaximumLOD = 300;
                 Shader.DisableKeyword("QUALITY_HGH");
                 Shader.EnableKeyword("QUALITY_MED");
                 Shader.DisableKeyword("QUALITY_LOW");
@@ -191,18 +190,18 @@
             {
                 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);
             }
@@ -217,15 +216,7 @@
         }
     }
 
-    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()
     {
@@ -236,6 +227,18 @@
     {
         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()
@@ -264,4 +267,11 @@
     Low = 0,
     Medium = 1,
     High = 2,
+}
+
+public enum GameFps
+{
+    Free = -1,
+    Half = 30,
+    Full = 60,
 }
\ No newline at end of file

--
Gitblit v1.8.0