From b4f244fca02c24eb02d7b200a3ff1d0d2e17281a Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期五, 24 八月 2018 11:49:16 +0800
Subject: [PATCH] 2824 1.0.15【前端】系统设置的标签页新增最大帧数选项
---
System/SystemSetting/SystemSetting.cs | 46 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/System/SystemSetting/SystemSetting.cs b/System/SystemSetting/SystemSetting.cs
index bb1fc38..f169b15 100644
--- a/System/SystemSetting/SystemSetting.cs
+++ b/System/SystemSetting/SystemSetting.cs
@@ -12,7 +12,7 @@
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 +21,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 +54,28 @@
return LocalSave.GetFloat(SOUND_EFFECT_KEY, 1);
}
- public void SetVSyncCount(int _vSync)
+ public void SetGameFrame(GameFrame _frame)
{
- LocalSave.SetInt(VSYNC_KEY, QualitySettings.vSyncCount = Mathf.Clamp(_vSync, 0, 2));
-
- if (vSyncCountChangeEvent != null)
+ LocalSave.SetInt(GAMEFRAME_KEY, (int)_frame);
+ switch (_frame)
{
- vSyncCountChangeEvent();
+ case GameFrame.FullFrame:
+ SetFPSLimit(60);
+ break;
+ case GameFrame.HalfFrame:
+ SetFPSLimit(30);
+ break;
+ }
+
+ if (gameFrameChangeEvent != null)
+ {
+ gameFrameChangeEvent();
}
}
- public int GetVSyncCount()
+ public GameFrame GetGameFrame()
{
- return LocalSave.GetInt(VSYNC_KEY, 2);
+ return (GameFrame)LocalSave.GetInt(GAMEFRAME_KEY, (int)GameFrame.HalfFrame);
}
public void SetSystemSettingSwitch(SystemSwitch type, bool _value)
@@ -219,12 +228,20 @@
public void SetFPSLimit(int _fps)
{
- LocalSave.SetInt(FPS_KEY, Application.targetFrameRate = Mathf.Clamp(_fps, 30, 60));
+ Application.targetFrameRate = Mathf.Clamp(_fps, 30, 60);
}
public int GetFPSLimit()
{
- return LocalSave.GetInt(FPS_KEY, 30);
+ switch (GetGameFrame())
+ {
+ case GameFrame.HalfFrame:
+ return 30;
+ case GameFrame.FullFrame:
+ return 60;
+ default:
+ return 30;
+ }
}
public void LetFPSUnLimit()
@@ -264,4 +281,11 @@
Low = 0,
Medium = 1,
High = 2,
+}
+
+public enum GameFrame
+{
+ Free = 0,
+ HalfFrame = 1,
+ FullFrame = 2,
}
\ No newline at end of file
--
Gitblit v1.8.0