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 LibraryWonderUI : LibrarySubUIBase { public WonderLibrary WonderSelected; public LibraryWonderUI(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 = 7; var needList = new List(); needList.Add(WonderLibrary.EgyptianRemiliaPEACE); needList.Add(WonderLibrary.EgyptianRemiliaKNOWLEDGE); needList.Add(WonderLibrary.EgyptianRemiliaTRADE); needList.Add(WonderLibrary.EgyptianRemiliaWEALTH); needList.Add(WonderLibrary.EgyptianRemiliaPOWER); needList.Add(WonderLibrary.EgyptianRemiliaPARK); needList.Add(WonderLibrary.EgyptianRemiliaEYE); //col=4 一行有4个item int col = 4; //根据需要展示的情况,确定table下的显示位置够不够,多的setactive false,少的clone int hasCount = table.childCount * col; //如果坑位少于需要展示的数量,增加坑位 var sampleRow = table.Find("SampleRow"); while (hasCount < needCount) { GameObject.Instantiate(sampleRow, table); hasCount += col; } //将最后一行多出来的坑位setactive false int lastCount = needCount; while (lastCount < hasCount) { table.GetChild(lastCount / col).GetChild(lastCount % col).gameObject.SetActive(false); lastCount++; } //总计的成就星星数量 int allStar = 0; //设置每一个wonder for(int i = 0;i < needList.Count; i++) { var wonder = needList[i]; if(!Table.Instance.GridAndResourceDataAssets.GetWonderInfo( wonder, out var wonderInfo))continue; //更换sprite if (table.GetChild(i / col) == null) continue; var slot = table.GetChild( i / col).GetChild(i % col); if (slot == null) continue; slot.Find("Size/TribeIconMask/TribeIcon").GetComponent().sprite = wonderInfo.Sprite; Button slotButton = slot.GetComponent