2025-01-02 12:15:45 +08:00

130 lines
5.3 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.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(() =>
{
UI_Manage.Instance.ShowPanel("ScoreDataPanel", System.Type.GetType("ZXK.LouDiXvMuNiu.ScoreDataPanel"), UIGroup.Tip);
});
_desBtn.onClick.AddListener(() =>
{
UI_Manage.Instance.ShowPanel("ExplainContainPanel", System.Type.GetType("ZXK.LouDiXvMuNiu.ExplainContainPanel"), UIGroup.Tip);
});
_setBtn.onClick.AddListener(() =>
{
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;
}
}
}
}