| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | public class SystemSetWin : MonoBehaviour |
| | | { |
| | | #region 得到组件 |
| | | |
| | | [SerializeField] Slider m_MusicSlider; |
| | | [SerializeField] Slider m_SoundEffectSlider; |
| | | |
| | | [SerializeField] Toggle m_HighQuality; |
| | | [SerializeField] Toggle m_MediumQuality; |
| | | [SerializeField] Toggle m_LowQuality; |
| | | |
| | | [SerializeField] Toggle m_OtherPlayer; |
| | | [SerializeField] Toggle m_Monster; |
| | | |
| | | [SerializeField] Slider m_SyncPlayerSlider; |
| | | [SerializeField] Text m_SyncPlayerCount; |
| | | |
| | | [SerializeField] Button m_SwitchAccountBtn; |
| | | [SerializeField] Text m_SwitchAccountTitle; |
| | | [SerializeField] Button m_LockScreenBtn; |
| | | [SerializeField] Button m_ServiceBulletinsBtn; |
| | | [SerializeField] Button m_AntiAddition; |
| | | |
| | | [SerializeField] Text m_PlayerInfoText; |
| | | [SerializeField] Button m_CopyBtn; |
| | | |
| | | #endregion |
| | | |
| | | bool isInited = false; |
| | | |
| | | private int playerSyncCountRef = 15; |
| | | private string copyContent; |
| | | LoginModel loginModel { get { return ModelCenter.Instance.GetModel<LoginModel>(); } } |
| | | |
| | | private void Awake() |
| | | { |
| | | isInited = false; |
| | | |
| | | m_MusicSlider.onValueChanged.AddListener(OnSliderBgMusic); |
| | | m_SoundEffectSlider.onValueChanged.AddListener(OnSliderSoundEffect); |
| | | |
| | | m_HighQuality.AddListener(OnSetQualityHigh); |
| | | m_MediumQuality.AddListener(OnSetQualityMedium); |
| | | m_LowQuality.AddListener(OnSetQualityLow); |
| | | m_OtherPlayer.AddListener(OnShowOrHideOtherPlayers); |
| | | m_Monster.AddListener(OnShowOrHideMonsters); |
| | | |
| | | m_SyncPlayerSlider.AddListener(OnPlayerSyncCountChange); |
| | | |
| | | m_SwitchAccountBtn.AddListener(ClickSwitchAccountBtn); |
| | | m_LockScreenBtn.AddListener(ClickLockScreen); |
| | | m_CopyBtn.AddListener(ClickCopyBtn); |
| | | m_AntiAddition.AddListener(AntiAdditction); |
| | | } |
| | | |
| | | void OnEnable() |
| | | { |
| | | m_MusicSlider.value = SystemSetting.Instance.GetSoundVolume(); |
| | | m_SoundEffectSlider.value = SystemSetting.Instance.GetSoundEffect(); |
| | | |
| | | m_HighQuality.isOn = SystemSetting.Instance.GetCurrentQualityLevel() == GameQuality.High; |
| | | m_MediumQuality.isOn = SystemSetting.Instance.GetCurrentQualityLevel() == GameQuality.Medium; |
| | | m_LowQuality.isOn = SystemSetting.Instance.GetCurrentQualityLevel() == GameQuality.Low; |
| | | m_OtherPlayer.isOn = SystemSetting.Instance.GetSystemSettingSwitch(SystemSwitch.OtherPlayer); |
| | | m_Monster.isOn = !SystemSetting.Instance.GetSystemSettingSwitch(SystemSwitch.HideMonster); |
| | | m_SyncPlayerSlider.value = playerSyncCountRef = SystemSetting.Instance.GetPlayerSyncCount(); |
| | | m_SyncPlayerCount.text = playerSyncCountRef.ToString(); |
| | | |
| | | UpdateToggleSkin(m_HighQuality); |
| | | UpdateToggleSkin(m_MediumQuality); |
| | | UpdateToggleSkin(m_LowQuality); |
| | | UpdateToggleSkin(m_OtherPlayer); |
| | | UpdateToggleSkin(m_Monster); |
| | | |
| | | var serverName = ServerListCenter.Instance.GetServerData(ServerListCenter.Instance.currentServer.region_flag).name; |
| | | var playerAccount = PlayerDatas.Instance.baseData.AccID.Split('@'); |
| | | copyContent = StringUtility.Contact(serverName, "_", UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName), "_ID:", playerAccount[0]); |
| | | m_PlayerInfoText.text = copyContent; |
| | | |
| | | UpdateAccountBindTitle(); |
| | | |
| | | var sdkIDCheckIDAuthentication = ModelCenter.Instance.GetModel<LoginModel>().sdkIDCheckIDAuthentication; |
| | | var certificationState = sdkIDCheckIDAuthentication.type; |
| | | if (DTCB105_tagMCPlayerWallow.antiAddictionOpen) |
| | | { |
| | | if (certificationState == "1") |
| | | { |
| | | m_AntiAddition.gameObject.SetActive(false); |
| | | } |
| | | else if (certificationState == "2") |
| | | { |
| | | var idNumber = sdkIDCheckIDAuthentication.card_id; |
| | | m_AntiAddition.gameObject.SetActive(string.IsNullOrEmpty(idNumber) || !MathUtility.CheckAdult(idNumber)); |
| | | } |
| | | else |
| | | { |
| | | m_AntiAddition.gameObject.SetActive(true); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_AntiAddition.gameObject.SetActive(false); |
| | | } |
| | | |
| | | loginModel.accountBindOkEvent += UpdateAccountBindTitle; |
| | | SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk += OnAuthenticationOk; |
| | | SystemSetting.Instance.playerSyncCountChangeEvent += OnPlayerSyncCountChange; |
| | | |
| | | isInited = true; |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | isInited = false; |
| | | loginModel.accountBindOkEvent -= UpdateAccountBindTitle; |
| | | SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk -= OnAuthenticationOk; |
| | | SystemSetting.Instance.playerSyncCountChangeEvent -= OnPlayerSyncCountChange; |
| | | SystemSetting.Instance.SetPlayerSyncCount(playerSyncCountRef); |
| | | } |
| | | |
| | | private void ClickCopyBtn() |
| | | { |
| | | SDKUtility.Instance.CopyTextToClipboard(copyContent); |
| | | } |
| | | |
| | | private void OnSliderSoundEffect(float arg0) |
| | | { |
| | | SystemSetting.Instance.SetSoundEffect(arg0); |
| | | } |
| | | |
| | | private void OnSliderBgMusic(float arg0) |
| | | { |
| | | SystemSetting.Instance.SetSoundVolume(arg0); |
| | | } |
| | | |
| | | private void OnSetQualityHigh(bool _value) |
| | | { |
| | | if (_value) |
| | | { |
| | | SystemSetting.Instance.SetQualityLevel(GameQuality.High); |
| | | if (isInited) |
| | | { |
| | | SystemSetting.Instance.SetPlayerSyncCount(15); |
| | | } |
| | | } |
| | | |
| | | UpdateToggleSkin(m_HighQuality); |
| | | } |
| | | |
| | | private void OnSetQualityMedium(bool _value) |
| | | { |
| | | if (_value) |
| | | { |
| | | SystemSetting.Instance.SetQualityLevel(GameQuality.Medium); |
| | | if (isInited) |
| | | { |
| | | SystemSetting.Instance.SetPlayerSyncCount(10); |
| | | } |
| | | } |
| | | |
| | | UpdateToggleSkin(m_MediumQuality); |
| | | } |
| | | |
| | | private void OnSetQualityLow(bool _value) |
| | | { |
| | | if (_value) |
| | | { |
| | | SystemSetting.Instance.SetQualityLevel(GameQuality.Low); |
| | | if (isInited) |
| | | { |
| | | SystemSetting.Instance.SetPlayerSyncCount(5); |
| | | } |
| | | } |
| | | |
| | | UpdateToggleSkin(m_LowQuality); |
| | | } |
| | | |
| | | private void OnShowOrHideOtherPlayers(bool _value) |
| | | { |
| | | SystemSetting.Instance.SetSystemSettingSwitch(SystemSwitch.OtherPlayer, _value); |
| | | UpdateToggleSkin(m_OtherPlayer); |
| | | } |
| | | |
| | | private void OnShowOrHideMonsters(bool _value) |
| | | { |
| | | SystemSetting.Instance.SetSystemSettingSwitch(SystemSwitch.HideMonster, !_value); |
| | | UpdateToggleSkin(m_Monster); |
| | | } |
| | | |
| | | private void OnPlayerSyncCountChange(float _value) |
| | | { |
| | | playerSyncCountRef = (int)_value; |
| | | m_SyncPlayerCount.text = playerSyncCountRef.ToString(); |
| | | } |
| | | |
| | | private void UpdateToggleSkin(Toggle _toggle) |
| | | { |
| | | var bgText = _toggle.GetComponent<Text>("Background/Background_text"); |
| | | var checkText = _toggle.GetComponent<Text>("Background/Checkmark_text"); |
| | | |
| | | bgText.gameObject.SetActive(!_toggle.isOn); |
| | | checkText.gameObject.SetActive(_toggle.isOn); |
| | | } |
| | | |
| | | private void ClickSwitchAccountBtn() |
| | | { |
| | | switch (VersionConfig.Get().versionAuthority) |
| | | { |
| | | case VersionAuthority.InterTest: |
| | | GameNetSystem.Instance.LoginOut(); |
| | | break; |
| | | case VersionAuthority.Release: |
| | | SDKUtility.Instance.FreePlatformLoginout(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void ClickLockScreen() |
| | | { |
| | | if (!WindowJumpMgr.Instance.IsJumpState) |
| | | { |
| | | if (!WindowCenter.Instance.CheckOpen<MainInterfaceWin>()) |
| | | { |
| | | WindowCenter.Instance.Open<MainInterfaceWin>(); |
| | | } |
| | | } |
| | | |
| | | WindowCenter.Instance.CloseImmediately<SettingUpWin>(); |
| | | |
| | | if (!WindowCenter.Instance.CheckOpen<LockedScreenWin>()) |
| | | { |
| | | WindowCenter.Instance.Open<LockedScreenWin>(); |
| | | } |
| | | } |
| | | |
| | | private void UpdateAccountBindTitle() |
| | | { |
| | | m_SwitchAccountTitle.text = Language.Get("SwitchAccount"); |
| | | } |
| | | |
| | | private void AntiAdditction() |
| | | { |
| | | WindowCenter.Instance.Open<AntiAddictionWin>(); |
| | | } |
| | | |
| | | private void OnAuthenticationOk(SDKUtility.FP_DoIDAuthentication _result) |
| | | { |
| | | MessageWin.Inst.ShowFixedTip(_result.errordesc); |
| | | m_AntiAddition.gameObject.SetActive(_result.errorcode != "1"); |
| | | } |
| | | |
| | | private void OnPlayerSyncCountChange() |
| | | { |
| | | m_SyncPlayerSlider.value = playerSyncCountRef = SystemSetting.Instance.GetPlayerSyncCount(); |
| | | m_SyncPlayerCount.text = playerSyncCountRef.ToString(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class SystemSetWin : MonoBehaviour
|
| | | {
|
| | | #region 得到组件
|
| | |
|
| | | [SerializeField] Slider m_MusicSlider;
|
| | | [SerializeField] Slider m_SoundEffectSlider;
|
| | |
|
| | | [SerializeField] Toggle m_HighQuality;
|
| | | [SerializeField] Toggle m_MediumQuality;
|
| | | [SerializeField] Toggle m_LowQuality;
|
| | |
|
| | | [SerializeField] Toggle m_OtherPlayer;
|
| | | [SerializeField] Toggle m_Monster;
|
| | |
|
| | | [SerializeField] Slider m_SyncPlayerSlider;
|
| | | [SerializeField] Text m_SyncPlayerCount;
|
| | |
|
| | | [SerializeField] Button m_SwitchAccountBtn;
|
| | | [SerializeField] Text m_SwitchAccountTitle;
|
| | | [SerializeField] Button m_LockScreenBtn;
|
| | | [SerializeField] Button m_ServiceBulletinsBtn;
|
| | | [SerializeField] Button m_AntiAddition;
|
| | |
|
| | | [SerializeField] Text m_PlayerInfoText;
|
| | | [SerializeField] Button m_CopyBtn;
|
| | |
|
| | | #endregion
|
| | |
|
| | | bool isInited = false;
|
| | |
|
| | | private int playerSyncCountRef = 15;
|
| | | private string copyContent;
|
| | | LoginModel loginModel { get { return ModelCenter.Instance.GetModel<LoginModel>(); } }
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | isInited = false;
|
| | |
|
| | | m_MusicSlider.onValueChanged.AddListener(OnSliderBgMusic);
|
| | | m_SoundEffectSlider.onValueChanged.AddListener(OnSliderSoundEffect);
|
| | |
|
| | | m_HighQuality.AddListener(OnSetQualityHigh);
|
| | | m_MediumQuality.AddListener(OnSetQualityMedium);
|
| | | m_LowQuality.AddListener(OnSetQualityLow);
|
| | | m_OtherPlayer.AddListener(OnShowOrHideOtherPlayers);
|
| | | m_Monster.AddListener(OnShowOrHideMonsters);
|
| | |
|
| | | m_SyncPlayerSlider.AddListener(OnPlayerSyncCountChange);
|
| | |
|
| | | m_SwitchAccountBtn.AddListener(ClickSwitchAccountBtn);
|
| | | m_LockScreenBtn.AddListener(ClickLockScreen);
|
| | | m_CopyBtn.AddListener(ClickCopyBtn);
|
| | | m_AntiAddition.AddListener(AntiAdditction);
|
| | | }
|
| | |
|
| | | void OnEnable()
|
| | | {
|
| | | m_MusicSlider.value = SystemSetting.Instance.GetSoundVolume();
|
| | | m_SoundEffectSlider.value = SystemSetting.Instance.GetSoundEffect();
|
| | |
|
| | | m_HighQuality.isOn = SystemSetting.Instance.GetCurrentQualityLevel() == GameQuality.High;
|
| | | m_MediumQuality.isOn = SystemSetting.Instance.GetCurrentQualityLevel() == GameQuality.Medium;
|
| | | m_LowQuality.isOn = SystemSetting.Instance.GetCurrentQualityLevel() == GameQuality.Low;
|
| | | m_OtherPlayer.isOn = SystemSetting.Instance.GetSystemSettingSwitch(SystemSwitch.OtherPlayer);
|
| | | m_Monster.isOn = !SystemSetting.Instance.GetSystemSettingSwitch(SystemSwitch.HideMonster);
|
| | | m_SyncPlayerSlider.value = playerSyncCountRef = SystemSetting.Instance.GetPlayerSyncCount();
|
| | | m_SyncPlayerCount.text = playerSyncCountRef.ToString();
|
| | |
|
| | | UpdateToggleSkin(m_HighQuality);
|
| | | UpdateToggleSkin(m_MediumQuality);
|
| | | UpdateToggleSkin(m_LowQuality);
|
| | | UpdateToggleSkin(m_OtherPlayer);
|
| | | UpdateToggleSkin(m_Monster);
|
| | |
|
| | | var serverName = ServerListCenter.Instance.GetServerData(ServerListCenter.Instance.currentServer.region_flag).name;
|
| | | var playerAccount = PlayerDatas.Instance.baseData.AccID.Split('@');
|
| | | copyContent = StringUtility.Contact(serverName, "_", UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName), "_ID:", playerAccount[0]);
|
| | | m_PlayerInfoText.text = copyContent;
|
| | |
|
| | | UpdateAccountBindTitle();
|
| | |
|
| | | var sdkIDCheckIDAuthentication = ModelCenter.Instance.GetModel<LoginModel>().sdkIDCheckIDAuthentication;
|
| | | var certificationState = sdkIDCheckIDAuthentication.type;
|
| | | if (DTCB105_tagMCPlayerWallow.antiAddictionOpen)
|
| | | {
|
| | | if (certificationState == "1")
|
| | | {
|
| | | m_AntiAddition.gameObject.SetActive(false);
|
| | | }
|
| | | else if (certificationState == "2")
|
| | | {
|
| | | var idNumber = sdkIDCheckIDAuthentication.card_id;
|
| | | m_AntiAddition.gameObject.SetActive(string.IsNullOrEmpty(idNumber) || !MathUtility.CheckAdult(idNumber));
|
| | | }
|
| | | else
|
| | | {
|
| | | m_AntiAddition.gameObject.SetActive(true);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | m_AntiAddition.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | loginModel.accountBindOkEvent += UpdateAccountBindTitle;
|
| | | SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk += OnAuthenticationOk;
|
| | | SystemSetting.Instance.playerSyncCountChangeEvent += OnPlayerSyncCountChange;
|
| | |
|
| | | isInited = true;
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | isInited = false;
|
| | | loginModel.accountBindOkEvent -= UpdateAccountBindTitle;
|
| | | SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk -= OnAuthenticationOk;
|
| | | SystemSetting.Instance.playerSyncCountChangeEvent -= OnPlayerSyncCountChange;
|
| | | SystemSetting.Instance.SetPlayerSyncCount(playerSyncCountRef);
|
| | | }
|
| | |
|
| | | private void ClickCopyBtn()
|
| | | {
|
| | | SDKUtility.Instance.CopyContent(copyContent);
|
| | | }
|
| | |
|
| | | private void OnSliderSoundEffect(float arg0)
|
| | | {
|
| | | SystemSetting.Instance.SetSoundEffect(arg0);
|
| | | }
|
| | |
|
| | | private void OnSliderBgMusic(float arg0)
|
| | | {
|
| | | SystemSetting.Instance.SetSoundVolume(arg0);
|
| | | }
|
| | |
|
| | | private void OnSetQualityHigh(bool _value)
|
| | | {
|
| | | if (_value)
|
| | | {
|
| | | SystemSetting.Instance.SetQualityLevel(GameQuality.High);
|
| | | if (isInited)
|
| | | {
|
| | | SystemSetting.Instance.SetPlayerSyncCount(15);
|
| | | }
|
| | | }
|
| | |
|
| | | UpdateToggleSkin(m_HighQuality);
|
| | | }
|
| | |
|
| | | private void OnSetQualityMedium(bool _value)
|
| | | {
|
| | | if (_value)
|
| | | {
|
| | | SystemSetting.Instance.SetQualityLevel(GameQuality.Medium);
|
| | | if (isInited)
|
| | | {
|
| | | SystemSetting.Instance.SetPlayerSyncCount(10);
|
| | | }
|
| | | }
|
| | |
|
| | | UpdateToggleSkin(m_MediumQuality);
|
| | | }
|
| | |
|
| | | private void OnSetQualityLow(bool _value)
|
| | | {
|
| | | if (_value)
|
| | | {
|
| | | SystemSetting.Instance.SetQualityLevel(GameQuality.Low);
|
| | | if (isInited)
|
| | | {
|
| | | SystemSetting.Instance.SetPlayerSyncCount(5);
|
| | | }
|
| | | }
|
| | |
|
| | | UpdateToggleSkin(m_LowQuality);
|
| | | }
|
| | |
|
| | | private void OnShowOrHideOtherPlayers(bool _value)
|
| | | {
|
| | | SystemSetting.Instance.SetSystemSettingSwitch(SystemSwitch.OtherPlayer, _value);
|
| | | UpdateToggleSkin(m_OtherPlayer);
|
| | | }
|
| | |
|
| | | private void OnShowOrHideMonsters(bool _value)
|
| | | {
|
| | | SystemSetting.Instance.SetSystemSettingSwitch(SystemSwitch.HideMonster, !_value);
|
| | | UpdateToggleSkin(m_Monster);
|
| | | }
|
| | |
|
| | | private void OnPlayerSyncCountChange(float _value)
|
| | | {
|
| | | playerSyncCountRef = (int)_value;
|
| | | m_SyncPlayerCount.text = playerSyncCountRef.ToString();
|
| | | }
|
| | |
|
| | | private void UpdateToggleSkin(Toggle _toggle)
|
| | | {
|
| | | var bgText = _toggle.GetComponent<Text>("Background/Background_text");
|
| | | var checkText = _toggle.GetComponent<Text>("Background/Checkmark_text");
|
| | |
|
| | | bgText.gameObject.SetActive(!_toggle.isOn);
|
| | | checkText.gameObject.SetActive(_toggle.isOn);
|
| | | }
|
| | |
|
| | | private void ClickSwitchAccountBtn()
|
| | | {
|
| | | switch (VersionConfig.Get().versionAuthority)
|
| | | {
|
| | | case VersionAuthority.InterTest:
|
| | | GameNetSystem.Instance.LoginOut();
|
| | | break;
|
| | | case VersionAuthority.Release:
|
| | | SDKUtility.Instance.FreePlatformLoginout();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void ClickLockScreen()
|
| | | {
|
| | | if (!WindowJumpMgr.Instance.IsJumpState)
|
| | | {
|
| | | if (!WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
|
| | | {
|
| | | WindowCenter.Instance.Open<MainInterfaceWin>();
|
| | | }
|
| | | }
|
| | |
|
| | | WindowCenter.Instance.CloseImmediately<SettingUpWin>();
|
| | |
|
| | | if (!WindowCenter.Instance.CheckOpen<LockedScreenWin>())
|
| | | {
|
| | | WindowCenter.Instance.Open<LockedScreenWin>();
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateAccountBindTitle()
|
| | | {
|
| | | m_SwitchAccountTitle.text = Language.Get("SwitchAccount");
|
| | | }
|
| | |
|
| | | private void AntiAdditction()
|
| | | {
|
| | | WindowCenter.Instance.Open<AntiAddictionWin>();
|
| | | }
|
| | |
|
| | | private void OnAuthenticationOk(SDKUtility.FP_DoIDAuthentication _result)
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(_result.errordesc);
|
| | | m_AntiAddition.gameObject.SetActive(_result.errorcode != "1");
|
| | | }
|
| | |
|
| | | private void OnPlayerSyncCountChange()
|
| | | {
|
| | | m_SyncPlayerSlider.value = playerSyncCountRef = SystemSetting.Instance.GetPlayerSyncCount();
|
| | | m_SyncPlayerCount.text = playerSyncCountRef.ToString();
|
| | | }
|
| | |
|
| | | }
|
| | | }
|