选择封面初步提交
This commit is contained in:
67
Assets/TcgEngine/Scripts/Menu/ChangeCoverPanel.cs
Normal file
67
Assets/TcgEngine/Scripts/Menu/ChangeCoverPanel.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user