2025-09-08 17:37:12 +08:00

50 lines
1.7 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using ZXKFramework;
namespace DongWuYiXue.DaoNiaoShu
{
public class ShiXunPanel : UIBase
{
RectTransform content;
GameObject step;
public override string GroupName => "ShiXunPanel";
public override string Name => "ShiXunPanel";
public override void Init(IUIManager uictrl)
{
base.Init(uictrl);
content = transform.FindFirst<RectTransform>("Content");
step = transform.FindFirst<Transform>("Step").gameObject;
}
int seq = 0;
public override void Show()
{
base.Show();
GeneSteps();
}
void GeneSteps()
{
List<BaseData> listBaseData = GetModel<GameModel>().excelData.allBaseData;
for (int i = 0; i < listBaseData.Count; i++)
{
BaseData b = listBaseData[i];
if (string.IsNullOrEmpty(b.score_sx)) continue;
GameObject obj = Instantiate(step, content);
obj.SetActive(true);
Text id = obj.transform.FindFirst<Text>("ID");
Text name = obj.transform.FindFirst<Text>("Name");
Text type = obj.transform.FindFirst<Text>("Type");
Text maxScore = obj.transform.FindFirst<Text>("MaxScore");
Text score = obj.transform.FindFirst<Text>("Score");
seq++;
id.text = seq.ToString();
name.text = GetModel<GameModel>().excelData.GetTreeViewDatastate(b.state).data2;
type.text = b.type;
maxScore.text = b.score_sx;
score.text = b.score_sx;
}
}
}
}