134 lines
5.6 KiB
C#
Raw Normal View History

2025-01-02 12:15:45 +08:00
using CG.Framework;
using CG.UTility;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/*******************************************************************************
*Create By CG
*Function
*******************************************************************************/
namespace ZXK.LouDiXvMuNiu
{
public class AppSettingPanel : UIBase
{
private GameObject _modelNameGeo = null;
private Button _homeBtn = null;
private Button _scoreBtn = null;
private Button _desBtn = null;
private Button _setBtn = null;
private Button _closeBtn = null;
private Button _backBtn = null;
protected override void Awake()
{
base.Awake();
_modelNameGeo = GetWedage("TitleImg_N");
_homeBtn = GetWedage("homeBtn_N").GetComponent<Button>();
_scoreBtn = GetWedage("scoreBtn_N").GetComponent<Button>();
_desBtn = GetWedage("desBtn_N").GetComponent<Button>();
_setBtn = GetWedage("setBtn_N").GetComponent<Button>();
_closeBtn = GetWedage("closeBtn_N").GetComponent<Button>();
_backBtn = GetWedage("backBtn_N").GetComponent<Button>();
InitClick();
}
private void FixedUpdate()
{
System.Type curType = GameManager.Instance._StateContext.GetState();
switch (curType.Name)
{
case "HomeState":
_modelNameGeo.SetActive(false);
_homeBtn.gameObject.SetActive(false);
_scoreBtn.gameObject.SetActive(false);
_desBtn.gameObject.SetActive(false);
_setBtn.gameObject.SetActive(false);
_closeBtn.gameObject.SetActive(false);
_backBtn.gameObject.SetActive(false);
break;
case "ModelSelectState":
_modelNameGeo.SetActive(false);
_homeBtn.gameObject.SetActive(false);
_scoreBtn.gameObject.SetActive(false);
_desBtn.gameObject.SetActive(false);
_setBtn.gameObject.SetActive(true);
_closeBtn.gameObject.SetActive(true);
_backBtn.gameObject.SetActive(true);
break;
case "TrainState":
_modelNameGeo.SetActive(true);
_modelNameGeo.transform.Find("Text").GetComponent<Text>().text = GameManager.Instance._CurModelType;
_homeBtn.gameObject.SetActive(true);
_scoreBtn.gameObject.SetActive(false);
_desBtn.gameObject.SetActive(true);
_setBtn.gameObject.SetActive(true);
_closeBtn.gameObject.SetActive(true);
_backBtn.gameObject.SetActive(true);
break;
case "ExamState":
_modelNameGeo.SetActive(true);
_modelNameGeo.transform.Find("Text").GetComponent<Text>().text = GameManager.Instance._CurModelType;
_homeBtn.gameObject.SetActive(true);
_scoreBtn.gameObject.SetActive(true);
_desBtn.gameObject.SetActive(true);
_setBtn.gameObject.SetActive(true);
_closeBtn.gameObject.SetActive(true);
_backBtn.gameObject.SetActive(true);
break;
}
}
private void InitClick()
{
_homeBtn.onClick.AddListener(() =>
{
GameManager.Instance._StateContext.SetState(
new HomeState(GameManager.Instance._StateContext));
});
_scoreBtn.onClick.AddListener(() =>
{
2025-01-09 18:12:40 +08:00
PopUpMng._TriAble = false;
2025-01-02 12:15:45 +08:00
UI_Manage.Instance.ShowPanel("ScoreDataPanel", System.Type.GetType("ZXK.LouDiXvMuNiu.ScoreDataPanel"), UIGroup.Tip);
});
_desBtn.onClick.AddListener(() =>
{
2025-01-09 18:12:40 +08:00
PopUpMng._TriAble = false;
2025-01-14 15:34:07 +08:00
GameObject explainContainGeo = UI_Manage.Instance.ShowPanel("ExplainContainPanel", System.Type.GetType("ZXK.LouDiXvMuNiu.ExplainContainPanel"), UIGroup.Tip);
explainContainGeo.GetComponent<ExplainContainPanel>()._IsFirstEnter = false;
2025-01-02 12:15:45 +08:00
});
_setBtn.onClick.AddListener(() =>
{
2025-01-09 18:12:40 +08:00
PopUpMng._TriAble = false;
2025-01-02 12:15:45 +08:00
UI_Manage.Instance.ShowPanel("VolumeTranSettingPanel", System.Type.GetType("ZXK.LouDiXvMuNiu.VolumeTranSettingPanel"), UIGroup.Tip);
});
_closeBtn.onClick.AddListener(() =>
{
PopUpMng.PopConBox("<22><>ʾ", "<22>Ƿ<EFBFBD><C7B7>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>", "<22><>", () =>
{
UtilitiesMng.CustomQuit();
});
});
_backBtn.onClick.AddListener(ReturnExit);
}
private void ReturnExit()
{
System.Type curType = GameManager.Instance._StateContext.GetState();
switch (curType.Name)
{
case "ModelSelectState":
GameManager.Instance._StateContext.SetState(
new HomeState(GameManager.Instance._StateContext));
break;
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;
}
}
}
}