Files
JJBB/Assets/Project/Script/GUI/Equip/EquipStarProcess.cs

50 lines
1012 B
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using Games.Item;
using GCGame.Table;
public class EquipStarProcess : UIItemBase
{
public GameObject[] _HalfStars;
public GameObject[] _Stars;
private int _StarCount;
public int Value
{
get
{
return _StarCount;
}
set
{
_StarCount = value;
SetStar();
}
}
private void SetStar()
{
int starCount = (int)(_StarCount * 0.5f);
for (int i = 0; i < _Stars.Length; ++i)
{
if (i < starCount)
{
_Stars[i].SetActive(true);
}
else
{
_Stars[i].SetActive(false);
}
_HalfStars[i].SetActive(false);
}
if (_StarCount > starCount * 2)
{
if(starCount <= _HalfStars.Length && starCount >= 0)
_HalfStars[starCount].SetActive(true);
}
}
}