_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Scene_shop/wokePanel.cs
2024-12-10 12:01:29 +08:00

67 lines
1.9 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class wokePanel : ui_huodong
{
public Image icon;
[Header("大的物品名的TextPro")]
public TextMeshProUGUI BigNameText;
[Header("物品名的TextPro")]
public TextMeshProUGUI NameText;
[Header("物品价格的TextPro")]
public TextMeshProUGUI priceText;
[Header("物品价格的详细介绍")]
public Text info;
private int id;
public Button BuyBtn;
public async void initShow(int id,string iconUrl,string BigNameText,string NameText,string priceText,string info)
{
this.id = id;
this.icon.sprite = await Base.GlobalObj.GetComponent<ImageLoader>().LoadImageAsync(iconUrl);
this.BigNameText.text = BigNameText;
this.NameText.text = NameText;
this.priceText.text = "¥" + priceText;
this.info.text = info;
//await Base.GlobalObj.GetComponent<ImageLoader>().LoadImageAsync(Url);
BuyBtn.onClick.AddListener(async()=> {
await Scene_main_jiekou.instance.ShopOneItem(id);
if (Scene_main_jiekou.instance.IsBuyGet)
{
addEventPopUp("购买成功");
}
else
{
addEventPopUp("购买失败");
}
});
}
public void initShow(int id,string BigNameText, string NameText, string priceText, string info)
{
this.id = id;
this.BigNameText.text = BigNameText;
this.NameText.text = NameText;
this.priceText.text = "¥"+priceText;
this.info.text = info;
BuyBtn.onClick.AddListener(async () => {
await Scene_main_jiekou.instance.ShopOneItem(id);
if (Scene_main_jiekou.instance.IsBuyGet)
{
addEventPopUp("购买成功");
}
else
{
addEventPopUp("购买失败");
}
});
}
}