loudixvmuniu/Assets/_Scripts/Application/UI/ModelSelectPanel.cs
2025-01-02 12:15:45 +08:00

44 lines
1.6 KiB
C#

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 ModelSelectPanel : UIBase
{
private GameObject _itemPrefab = null;
private Transform _content = null;
protected override void Awake()
{
base.Awake();
_itemPrefab = GetWedage("ModuleChosePanel_ModuleItem_N");
_content = GetWedage("ModuleChoseContent_N").transform;
foreach (string modelName in GameManager.Instance._DataNiuHandler.NiuStepTypeDic.Keys)
{
GameObject geoSel = GameObject.Instantiate(_itemPrefab, _content);
geoSel.name = modelName;
geoSel.transform.Find("Item_Name").GetComponent<Text>().text = modelName;
geoSel.GetComponent<Button>().onClick.AddListener(() =>
{
GameManager.Instance._CurModelType = modelName;
if (GameManager.Instance._IsTrain)
{
GameManager.Instance._StateContext.SetState(new TrainState(GameManager.Instance._StateContext));
}
else
{
GameManager.Instance._StateContext.SetState(new ExamState(GameManager.Instance._StateContext));
}
});
geoSel.SetActive(true);
}
}
}
}