_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Scene_shop/itemInfo.cs

41 lines
947 B
C#
Raw Normal View History

2024-11-25 14:35:28 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class itemInfo : MonoBehaviour
{
[Header("<22><>ʾ<EFBFBD><CABE>Ʒ<EFBFBD><C6B7>image")]
public Image iconImage;
[Header("<22><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>TextPro")]
public TextMeshProUGUI nameText;
[Header("<22><>Ʒ<EFBFBD>۸<EFBFBD><DBB8><EFBFBD>TextPro")]
2024-11-28 00:39:35 +08:00
public TextMeshProUGUI priceText;
2024-11-25 14:35:28 +08:00
private int id;//item id
2024-11-28 00:39:35 +08:00
2024-11-25 14:35:28 +08:00
public async void initShow(int id, string iconURL, string name, string price)
2024-11-27 22:22:41 +08:00
{
this.id = id;
2024-12-02 15:35:46 +08:00
iconImage.sprite = Base.GlobalObj.GetComponent<ImageLoader>().sprite;
iconImage.sprite = await Base.GlobalObj.GetComponent<ImageLoader>().LoadImageAsync(iconURL);
2024-11-25 14:35:28 +08:00
nameText.text = name;
2024-11-28 00:39:35 +08:00
priceText.text = "<22><>" + price;
2024-11-27 22:22:41 +08:00
}
2024-11-25 14:35:28 +08:00
2024-11-27 23:39:41 +08:00
public void initShow(int id, string name, string price)
2024-11-27 22:22:41 +08:00
{
2024-11-28 00:39:35 +08:00
2024-11-27 22:22:41 +08:00
this.id = id;
nameText.text = name;
2024-11-28 00:39:35 +08:00
priceText.text = "<22><>"+price;
2024-11-27 22:22:41 +08:00
}
2024-11-25 14:35:28 +08:00
}