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);
        }
    }

}