Files
BH3/Assets/Scripts/Assembly-CSharp/MoleMole/MonoItemIconStar.cs
2025-08-13 09:26:42 +08:00

33 lines
782 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace MoleMole
{
public class MonoItemIconStar : MonoBehaviour
{
private const string ITEM_STAR_PREFAB_PATH = "SpriteOutput/GeneralUI/Star";
private const string ITEM_STAR_GREY_PREFAB_PATH = "SpriteOutput/GeneralUI/StarGray";
public void SetupView(int star, int maxStar)
{
for (int i = 0; i < base.transform.childCount; i++)
{
Image component = base.transform.GetChild(i).GetComponent<Image>();
component.gameObject.SetActive(i < maxStar);
if (i < maxStar)
{
if (i < star)
{
component.sprite = Miscs.GetSpriteByPrefab("SpriteOutput/GeneralUI/Star");
}
else
{
component.sprite = Miscs.GetSpriteByPrefab("SpriteOutput/GeneralUI/StarGray");
}
}
}
}
}
}