70 lines
1.7 KiB
C#
70 lines
1.7 KiB
C#
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生成并排布所有卡片封面
|
|
/// </summary>
|
|
private void GenerateCardCovers()
|
|
{
|
|
Debug.Log("数据有"+CardCoverData.GetAll().Count);
|
|
foreach (CardCoverData cover in CardCoverData.GetAll())
|
|
{
|
|
GameObject cardCover = Instantiate(coverPrefab, content);
|
|
var line = cardCover.GetComponent<ChangeCoverLine>();
|
|
line.SetCover(cover.GetCardCover(), cover.name);
|
|
}
|
|
}
|
|
|
|
private void RefreshPanel()
|
|
{
|
|
// dsdd
|
|
int ss = 0;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|