using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace TcgEngine.UI { public class ChangeCoverPanel : UIPanel { public Text coverNameText; public Transform content; public GameObject coverPrefab; private static ChangeCoverPanel instance; protected override void Awake() { base.Awake(); instance = this; for (int i = 0; i < content.childCount; i++) Destroy(content.GetChild(i).gameObject); } protected override void Start() { base.Start(); GenerateCardCovers(); } /// /// 生成并排布所有卡片封面 /// private void GenerateCardCovers() { Debug.Log("数据有"+CardCoverData.GetAll().Count); foreach (CardCoverData cover in CardCoverData.GetAll()) { GameObject cardCover = Instantiate(coverPrefab, content); var line = cardCover.GetComponent(); line.SetCover(cover.GetCardCover(), cover.name); } } private void RefreshPanel() { } public void OpenPanel(DeckLine line) { Show(); RefreshPanel(); coverNameText.text = line.title.text; } public override void Show(bool instant = false) { base.Show(instant); } public static ChangeCoverPanel Get() { return instance; } } }