_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Scene_shop/itemInfo.cs
2024-12-02 15:35:46 +08:00

41 lines
947 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class itemInfo : MonoBehaviour
{
[Header("显示物品的image")]
public Image iconImage;
[Header("物品名的TextPro")]
public TextMeshProUGUI nameText;
[Header("物品价格的TextPro")]
public TextMeshProUGUI priceText;
private int id;//item id
public async void initShow(int id, string iconURL, string name, string price)
{
this.id = id;
iconImage.sprite = Base.GlobalObj.GetComponent<ImageLoader>().sprite;
iconImage.sprite = await Base.GlobalObj.GetComponent<ImageLoader>().LoadImageAsync(iconURL);
nameText.text = name;
priceText.text = "¥" + price;
}
public void initShow(int id, string name, string price)
{
this.id = id;
nameText.text = name;
priceText.text = "¥"+price;
}
}