using UnityEngine; using Logic; using RuntimeData; using Animancer; using UnityEngine.UI; using System.Collections.Generic; using System.Net; using Logic.Multilingual; using TH1Resource; using TMPro; using Unity.VisualScripting; namespace UI.LibraryUI { public class LibraryGiantUI : LibrarySubUIBase { public GiantType GiantSelected; public LibraryGiantUI(LibrarySubUIType type,Button enterButton, GameObject panel,LibraryUI libraryUI) : base(type,enterButton,panel,libraryUI) { } //更新listpanel的信息 protected override void UpdateListPanel() { var table = ListPanel.transform.Find("Scroll View/Viewport/Content"); //构造needList,需要展示的giant list int needCount = 5; var needList = new List(); needList.Add(GiantType.EgyptianRemilia); needList.Add(GiantType.EgyptianPatchouli); needList.Add(GiantType.EgyptianSakuya); needList.Add(GiantType.EgyptianFlandre); needList.Add(GiantType.EgyptianMeiling); //根据需要展示的情况,确定table下的显示位置够不够,多的setactive false,少的clone int hasCount = table.childCount * 3; //如果坑位少于需要展示的数量,增加坑位 var sampleRow = table.Find("SampleRow"); while (hasCount < needCount) { GameObject.Instantiate(sampleRow, table); hasCount += 3; } //将最后一行多出来的坑位setactive false int lastCount = needCount; while (lastCount < hasCount) { table.GetChild(lastCount / 3).GetChild(lastCount % 3).gameObject.SetActive(false); lastCount++; } //总计的成就星星数量 int allStar = 0; //设置每一个giant for(int i = 0;i < needList.Count; i++) { var giant = needList[i]; if(!Table.Instance.UnitTypeDataAssets.GetUnitTypeInfo(UnitType.Giant, giant,0, out var unitInfo))continue; //更换sprite if (table.GetChild(i / 3) == null) continue; var slot = table.GetChild( i / 3).GetChild(i % 3); if (slot == null) continue; slot.Find("TribeIconMask/TribeIcon").GetComponent().sprite = unitInfo.Sprite; //如果是giantCivId !=0 默认锁角色 if (unitInfo.GiantCivId != 0) continue; //处理remilia 阵营 slot.Find("TribeIconMask").GetComponent().color = Color.white; slot.Find("TribeIconMask/TribeIcon").GetComponent().color = Color.white; slot.Find("TribeIconMask/Locked").gameObject.SetActive(false); Button slotButton = slot.GetComponent