119 lines
5.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using CG.Framework;
using CG.UTility;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/*******************************************************************************
*Create By CG
*Function
*******************************************************************************/
namespace ZXK.GYJQR
{
public class AppSettingPanel : UIBase
{
private Slider _voiceSlider = null;
private Slider _flexibleSlider = null;
private Button _voiceAdd_N = null;
private Button _voiceSub_N = null;
private Button _flexibleAdd_N = null;
private Button _flexibleSub_N = null;
protected override void Awake()
{
base.Awake();
}
private void Start()
{
AddEventListener("SettingBtn_N", UIEventType.OnToggleValueChanged, (bool isOn)=> {
GetWedage("SettingContain_N").gameObject.SetActive(isOn);
if (Camera.main.GetComponent<CameraAroundCtrl>())
Camera.main.GetComponent<CameraAroundCtrl>()._AllForbid = isOn;
if (Camera.main.GetComponent<CameraControl>())
Camera.main.GetComponent<CameraControl>()._AllForbid = isOn;
UI_Manage.Instance.GetPanel("AppSettingPanel").transform.SetAsLastSibling();
CG.UTility.PopUpMng._TriAble = false;
});
AddEventListener("CloseBtn_N", UIEventType.OnButtonClick, () => {
GetWedage("SettingContain_N").gameObject.SetActive(false);
if (Camera.main.GetComponent<CameraAroundCtrl>())
Camera.main.GetComponent<CameraAroundCtrl>()._AllForbid = false;
if (Camera.main.GetComponent<CameraControl>())
Camera.main.GetComponent<CameraControl>()._AllForbid = false;
CG.UTility.PopUpMng._TriAble = true;
});
AddEventListener("ReturnBtn_N", UIEventType.OnButtonClick, ReturnExit);
_voiceSlider = GetWedage("VoiceSlider_N").GetComponent<Slider>();
_flexibleSlider=GetWedage("FlexibleSlider_N").GetComponent<Slider>();
_voiceAdd_N = GetWedage("VoiceAdd_N").GetComponent<Button>();
_voiceSub_N = GetWedage("VoiceSub_N").GetComponent<Button>();
_flexibleAdd_N = GetWedage("FlexibleAdd_N").GetComponent<Button>();
_flexibleSub_N = GetWedage("FlexibleSub_N").GetComponent<Button>();
_voiceSlider.onValueChanged.AddListener((float slid) =>
{
GameManager.Instance._CurAppVoice = slid;
});
_flexibleSlider.onValueChanged.AddListener((float slid) =>
{
GameManager.Instance._CurMouseFlexible = slid;
});
_voiceAdd_N.onClick.AddListener(() => {
_voiceSlider.value += 5;
_voiceSlider.value = Mathf.Clamp(_voiceSlider.value, 0, 100);
});
_voiceSub_N.onClick.AddListener(() => {
_voiceSlider.value -= 5;
_voiceSlider.value = Mathf.Clamp(_voiceSlider.value, 0, 100);
});
_flexibleAdd_N.onClick.AddListener(() => {
_flexibleSlider.value += 5;
_flexibleSlider.value = Mathf.Clamp(_flexibleSlider.value, 0, 100);
});
_flexibleSub_N.onClick.AddListener(() => {
_flexibleSlider.value -= 5;
_flexibleSlider.value = Mathf.Clamp(_flexibleSlider.value, 0, 100);
});
SetText("TitleTxt_N", EnumCtrl.GetEnumDescription(GameManager.Instance._CurSystemType));
}
private void OnEnable()
{
GetWedage("VoiceSlider_N").GetComponent<Slider>().value = GameManager.Instance._CurAppVoice;
GetWedage("FlexibleSlider_N").GetComponent<Slider>().value = GameManager.Instance._CurMouseFlexible;
GameObject.FindGameObjectWithTag("MainCanvas").transform.Find("Top/BG").gameObject.SetActive(true);
}
private void OnDisable()
{
GameObject.FindGameObjectWithTag("MainCanvas").transform.Find("Top/BG").gameObject.SetActive(false);
}
private void ReturnExit()
{
System.Type curType= GameManager.Instance._StateContext.GetState();
switch (curType.Name)
{
case "LoginState":
UtilitiesMng.CustomQuit();
break;
case "HomeState":
GameManager.Instance._StateContext.SetState(
new LoginState(GameManager.Instance._StateContext));
break;
case "ModelSelectState":
GameManager.Instance._StateContext.SetState(
new HomeState(GameManager.Instance._StateContext));
break;
case "TeachState":
case "TrainState":
case "ExamState":
PopUpMng.PopConBox("<22><>ʾ", "<22>Ƿ<EFBFBD><C7B7>˳<EFBFBD><CBB3><EFBFBD>ǰģ<C7B0>飿", "<22><>","<22><>", () => {
GameManager.Instance._StateContext.SetState(
new ModelSelectState(GameManager.Instance._StateContext));
});
break;
}
}
}
}