60 lines
2.4 KiB
C#
60 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using ZXKFramework;
|
|
namespace YiLiao.SiBuChuZhen
|
|
{
|
|
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;
|
|
transform.FindFirst<Text>("Title").text = "ʵѵ½á¹û";
|
|
transform.FindFirst<Text>("Text1").text = GetModel<GameModel>().GetLanguage(15);
|
|
transform.FindFirst<Text>("Text2").text = GetModel<GameModel>().GetLanguage(16);
|
|
transform.FindFirst<Text>("Text2-2").text = "ÀàÐÍ";
|
|
transform.FindFirst<Text>("Text3").text = GetModel<GameModel>().GetLanguage(17);
|
|
transform.FindFirst<Text>("Text4").text = GetModel<GameModel>().GetLanguage(18);
|
|
GeneSteps();
|
|
}
|
|
int seq = 0;
|
|
public 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 = string.IsNullOrEmpty(b.childName)?b.name:b.childName;
|
|
type.text = b.type;
|
|
maxScore.text = b.score_sx;
|
|
score.text = b.score_sx;
|
|
if (seq % 2 == 0)
|
|
{
|
|
obj.transform.FindFirst<Image>("bg").gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
obj.transform.FindFirst<Image>("bg").gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |