This commit is contained in:
YiHan0621
2025-10-11 14:30:38 +08:00
parent 6c98d9a449
commit 2e4a318ca3
158 changed files with 7344 additions and 2213 deletions

View File

@@ -6,9 +6,8 @@ using UnityEngine.UI;
namespace TcgEngine.UI
{
/// <summary>
/// Pack panel is similar to the collection, but shows all the packs you own and all available packs
/// 卡包面板与收藏相似,但会显示您拥有的所有卡包以及所有可用卡包
/// </summary>
public class PackPanel : UIPanel
{
[Header("Packs")]
@@ -17,6 +16,13 @@ namespace TcgEngine.UI
public CardGrid grid_content;
public GameObject pack_prefab;
[Header("货币")]
public Text coin;
public Text crystal;
[Header("当前选择准备卡组")]
public PackData preparePack;
private List<GameObject> pack_list = new List<GameObject>();
private static PackPanel instance;
@@ -29,13 +35,11 @@ namespace TcgEngine.UI
//Delete grid content
for (int i = 0; i < grid_content.transform.childCount; i++)
Destroy(grid_content.transform.GetChild(i).gameObject);
}
protected override void Start()
{
base.Start();
}
protected override void Update()
@@ -50,10 +54,14 @@ namespace TcgEngine.UI
RefreshPacks();
}
/// <summary>
/// 刷新全部
/// </summary>
private void RefreshAll()
{
RefreshPacks();
RefreshStarterDeck();
RefreshCurrency();
}
public void RefreshPacks()
@@ -72,6 +80,10 @@ namespace TcgEngine.UI
pack_ui.onClick += OnClickPack;
pack_ui.onClickRight += OnClickPack;
pack_list.Add(nPack);
if (pack.title == "白银卡包")
{
SetPackData(pack);
}
}
}
@@ -87,6 +99,39 @@ namespace TcgEngine.UI
}
}
}
private void OnClickPack()
{
if (preparePack != null)
{
PackZoomPanel.Get().OnClickBuy(preparePack);
}
}
/// <summary>
/// 刷新货币
/// </summary>
public void RefreshCurrency()
{
coin.text = MainMenu.Get().credits_txt.text;
crystal.text = MainMenu.Get().crystalText.text;
}
/// <summary>
/// 设置即将打开卡包的数据
/// </summary>
private string SetPackData(PackData pack)
{
PlayerPrefs.SetString("SetPack",pack.id);
if (PlayerPrefs.GetString("SetPack") != null)
{
string setPack = PlayerPrefs.GetString("SetPack");
Debug.Log($"已设置{setPack},准备就绪");
}
return PlayerPrefs.GetString("SetPack");
}
public void OnClickPack(PackUI pack)
{