少年修仙传客户端代码仓库
client_Wu Xijin
2018-08-23 e925aced4b439a2583a86d2924d070373b4a89d3
2824 1.0.15【前端】系统设置的标签页新增最大帧数选项
3个文件已修改
2个文件已添加
121 ■■■■■ 已修改文件
Core/GameEngine/Login/Launch.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/SystemSetting/SystemSetWin.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/SystemSetting/SystemSetting.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/OnOffToggle.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI/Common/OnOffToggle.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Login/Launch.cs
@@ -43,6 +43,7 @@
        SoundPlayer.CreateSoundPlayer();
        SoundPlayer.Instance.PlayLoginMusic();
        SystemSetting.Instance.SetSoundVolume(SystemSetting.Instance.GetSoundVolume());
        SystemSetting.Instance.SetVSyncCount(SystemSetting.Instance.GetVSyncCount());
        SDKUtility.Instance.Init();
        GameObjectPoolManager.Instance.gameObject.name = "GameObjectPool";
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);
System/SystemSetting/SystemSetting.cs
@@ -12,6 +12,7 @@
    const string SOUND_VOLUME_KEY = "SoundRatioKey";  //音乐
    const string SOUND_EFFECT_KEY = "SoundEffect"; //音效
    const string FPS_KEY = "FPSKey";
    const string VSYNC_KEY = "GameVSyncCountSetting";//垂直同步率
    public Dictionary<SystemSwitch, bool> systemSettings = new Dictionary<SystemSwitch, bool>();
@@ -20,6 +21,7 @@
    public event Action<SystemSwitch, bool> OnSettingChanged;
    public event Action qualityLevelChangeEvent;
    public event Action playerSyncCountChangeEvent;
    public event Action vSyncCountChangeEvent;
    public SystemSetting()
    {
@@ -50,6 +52,21 @@
    public float GetSoundEffect()
    {
        return LocalSave.GetFloat(SOUND_EFFECT_KEY, 1);
    }
    public void SetVSyncCount(int _vSync)
    {
        LocalSave.SetInt(VSYNC_KEY, QualitySettings.vSyncCount = Mathf.Clamp(_vSync, 0, 2));
        if (vSyncCountChangeEvent != null)
        {
            vSyncCountChangeEvent();
        }
    }
    public int GetVSyncCount()
    {
        return LocalSave.GetInt(VSYNC_KEY, 2);
    }
    public void SetSystemSettingSwitch(SystemSwitch type, bool _value)
@@ -122,7 +139,6 @@
    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)
        {
@@ -131,6 +147,7 @@
                Shader.DisableKeyword("QUALITY_HGH");
                Shader.DisableKeyword("QUALITY_MED");
                Shader.EnableKeyword("QUALITY_LOW");
                SetVSyncCount(2);
                break;
            case GameQuality.Medium:
                Shader.globalMaximumLOD = 250;
UI/Common/OnOffToggle.cs
New file
@@ -0,0 +1,61 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, August 23, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.Events;
namespace Snxxz.UI
{
    public class OnOffToggle : MonoBehaviour
    {
        [SerializeField] Button m_Button;
        [SerializeField] RectTransform m_Handle;
        [SerializeField] Image m_BackGround;
        [SerializeField] RectTransform m_OnShow;
        [SerializeField] RectTransform m_OffShow;
        [SerializeField] Vector2 m_OnHandleOffset;
        [SerializeField] Vector2 m_OffHandleOffset;
        bool m_IsOn = false;
        public bool isOn {
            get { return m_IsOn; }
            set {
                m_IsOn = value;
                SwitchShowState(m_IsOn);
            }
        }
        public void AddListener(UnityAction _action)
        {
            if (m_Button != null)
            {
                m_Button.AddListener(_action);
            }
        }
        public void RemoveAllListeners()
        {
            if (m_Button != null)
            {
                m_Button.RemoveAllListeners();
            }
        }
        private void SwitchShowState(bool _isOn)
        {
            m_Handle.anchoredPosition = _isOn ? m_OnHandleOffset : m_OffHandleOffset;
            m_BackGround.SetSprite(_isOn ? "SettingUpWin_NO" : "SettingUpWin_OFF");
            m_OnShow.gameObject.SetActive(_isOn);
            m_OffShow.gameObject.SetActive(!_isOn);
        }
    }
}
UI/Common/OnOffToggle.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dd8929af600e643478d3f0a22d7e3c52
timeCreated: 1535009068
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: