using System;
using UnityEngine;

public class FluctuationOfParameterUnit : MonoBehaviour
{
	private void Awake()
	{
		this.bg_sprite_ = UTY.GetChildObject(base.gameObject, "BGGray", false).GetComponent<UISprite>();
		this.name_label_ = UTY.GetChildObject(base.gameObject, "Name", false).GetComponent<UILabel>();
		this.value_label_ = UTY.GetChildObject(base.gameObject, "Value", false).GetComponent<UILabel>();
	}

	public void SetActive(bool value)
	{
		base.gameObject.SetActive(value);
	}

	public bool IsActive()
	{
		return base.gameObject.activeSelf;
	}

	public void SetBGVisible(bool value)
	{
		this.bg_sprite_.enabled = value;
	}

	public bool IsBGVisible()
	{
		return this.bg_sprite_.enabled;
	}

	public void SetTextName(string name)
	{
		this.name_label_.text = name;
	}

	public void SetTextValue(int value)
	{
		this.value_label_.text = "0";
		if (this.AnimeTime <= 0f)
		{
			string str = string.Empty;
			if (0 < value)
			{
				str += "+";
			}
			this.value_label_.text = str + value.ToString();
		}
		else
		{
			this.anime_event_ = delegate()
			{
				iTween.ValueTo(this.gameObject, iTween.Hash(new object[]
				{
					"from",
					0,
					"to",
					value,
					"time",
					this.AnimeTime,
					"onupdate",
					"UpdateValue"
				}));
			};
		}
	}

	public void StartAnime()
	{
		if (this.anime_event_ != null)
		{
			this.anime_event_();
			this.anime_event_ = null;
		}
	}

	public void UpdateValue(int value)
	{
		string str = string.Empty;
		if (0 < value)
		{
			str += "+";
		}
		this.value_label_.text = str + value.ToString();
	}

	public float AnimeTime = 1f;

	private UISprite bg_sprite_;

	private UILabel name_label_;

	private UILabel value_label_;

	private Action anime_event_;
}
