From e925aced4b439a2583a86d2924d070373b4a89d3 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期四, 23 八月 2018 15:52:18 +0800
Subject: [PATCH] 2824 1.0.15【前端】系统设置的标签页新增最大帧数选项

---
 System/SystemSetting/SystemSetWin.cs |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/System/SystemSetting/SystemSetWin.cs b/System/SystemSetting/SystemSetWin.cs
index 9ebb3dc..fdf6b40 100644
--- a/System/SystemSetting/SystemSetWin.cs
+++ b/System/SystemSetting/SystemSetWin.cs
@@ -15,6 +15,7 @@
         [SerializeField] Toggle m_HighQuality;
         [SerializeField] Toggle m_MediumQuality;
         [SerializeField] Toggle m_LowQuality;
+        [SerializeField] OnOffToggle m_SixtyFrame;
 
         [SerializeField] Toggle m_OtherPlayer;
         [SerializeField] Toggle m_Monster;
@@ -49,6 +50,8 @@
             m_HighQuality.AddListener(OnSetQualityHigh);
             m_MediumQuality.AddListener(OnSetQualityMedium);
             m_LowQuality.AddListener(OnSetQualityLow);
+            m_SixtyFrame.AddListener(SwitchVSyncCount);
+
             m_OtherPlayer.AddListener(OnShowOrHideOtherPlayers);
             m_Monster.AddListener(OnShowOrHideMonsters);
 
@@ -78,6 +81,8 @@
             UpdateToggleSkin(m_LowQuality);
             UpdateToggleSkin(m_OtherPlayer);
             UpdateToggleSkin(m_Monster);
+
+            m_SixtyFrame.isOn = SystemSetting.Instance.GetVSyncCount() == 1;
 
             var serverName = ServerListCenter.Instance.GetServerData(ServerListCenter.Instance.currentServer.region_flag).name;
             var playerAccount = PlayerDatas.Instance.baseData.AccID.Split('@');
@@ -111,6 +116,7 @@
 
             loginModel.accountBindOkEvent += UpdateAccountBindTitle;
             SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk += OnAuthenticationOk;
+            SystemSetting.Instance.vSyncCountChangeEvent += OnSwitchVSyncCount;
             SystemSetting.Instance.playerSyncCountChangeEvent += OnPlayerSyncCountChange;
 
             isInited = true;
@@ -121,6 +127,7 @@
             isInited = false;
             loginModel.accountBindOkEvent -= UpdateAccountBindTitle;
             SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk -= OnAuthenticationOk;
+            SystemSetting.Instance.vSyncCountChangeEvent -= OnSwitchVSyncCount;
             SystemSetting.Instance.playerSyncCountChangeEvent -= OnPlayerSyncCountChange;
             SystemSetting.Instance.SetPlayerSyncCount(playerSyncCountRef);
         }
@@ -182,6 +189,27 @@
             UpdateToggleSkin(m_LowQuality);
         }
 
+        private void SwitchVSyncCount()
+        {
+            var currentVSyncCount = SystemSetting.Instance.GetVSyncCount();
+            switch (currentVSyncCount)
+            {
+                case 1:
+                    SystemSetting.Instance.SetVSyncCount(2);
+                    break;
+                case 2:
+                    SystemSetting.Instance.SetVSyncCount(1);
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        private void OnSwitchVSyncCount()
+        {
+            m_SixtyFrame.isOn = SystemSetting.Instance.GetVSyncCount() == 1;
+        }
+
         private void OnShowOrHideOtherPlayers(bool _value)
         {
             SystemSetting.Instance.SetSystemSettingSwitch(SystemSwitch.OtherPlayer, _value);

--
Gitblit v1.8.0