using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using wf;

public class YotogiOldParamBasicBar : MonoBehaviour
{
	public virtual void Awake()
	{
		if (0 < this.bar_dic_.Count)
		{
			return;
		}
		YotogiOldParamBasicBar.BarSet barSet = new YotogiOldParamBasicBar.BarSet();
		barSet.min = -100;
		barSet.max = 300;
		barSet.gauge_trans = UTY.GetChildObject(base.gameObject, "Excited/GaugeGroup/Gauge", false).transform;
		barSet.num_label = UTY.GetChildObject(base.gameObject, "Excited/Value", false).GetComponent<UILabel>();
		this.bar_dic_.Add(YotogiOldParamBasicBar.Kind.Excite, barSet);
		YotogiOldParamBasicBar.BarSet barSet2 = new YotogiOldParamBasicBar.BarSet();
		barSet2.min = 0;
		barSet2.max = 100;
		barSet2.gauge_trans = UTY.GetChildObject(base.gameObject, "Mind/GaugeGroup/Gauge", false).transform;
		barSet2.num_label = UTY.GetChildObject(base.gameObject, "Mind/Value", false).GetComponent<UILabel>();
		this.bar_dic_.Add(YotogiOldParamBasicBar.Kind.Mind, barSet2);
		YotogiOldParamBasicBar.BarSet barSet3 = new YotogiOldParamBasicBar.BarSet();
		barSet3.min = 0;
		barSet3.max = 100;
		barSet3.gauge_trans = UTY.GetChildObject(base.gameObject, "Reason/GaugeGroup/Gauge", false).transform;
		barSet3.num_label = UTY.GetChildObject(base.gameObject, "Reason/Value", false).GetComponent<UILabel>();
		this.bar_dic_.Add(YotogiOldParamBasicBar.Kind.Reason, barSet3);
		this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Blue, new Color(0f, 0.5f, 1f));
		this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Red, new Color(1f, 0f, 0f));
		this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Yellow, new Color(1f, 1f, 0f));
		this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Orange, new Color(1f, 0.5f, 0f));
	}

	public void SetMaid(Maid maid)
	{
		this.maid_ = maid;
	}

	public void SetMaxMind(int max_num)
	{
		this.bar_dic_[YotogiOldParamBasicBar.Kind.Mind].max = max_num;
	}

	public void SetMaxReason(int max_num)
	{
		this.bar_dic_[YotogiOldParamBasicBar.Kind.Reason].max = max_num;
	}

	public virtual void SetCurrentExcite(int cur_num, bool is_anime)
	{
		YotogiOldParamBasicBar.BarSet barSet = this.bar_dic_[YotogiOldParamBasicBar.Kind.Excite];
		barSet.num_label.text = cur_num.ToString();
		float num = (float)(cur_num + barSet.min * -1) / (float)barSet.max;
		num -= 0.333333343f;
		Color color;
		if (200 <= cur_num)
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Red];
		}
		else if (100 <= cur_num)
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Orange];
		}
		else if (0 <= cur_num)
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Yellow];
		}
		else
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Blue];
		}
		barSet.gauge_trans.GetComponent<UISprite>().color = color;
		Vector3 vector = new Vector3(num, 1f, 1f);
		if (is_anime)
		{
			Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
			iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
		}
		else
		{
			barSet.gauge_trans.localScale = vector;
		}
	}

	public void SetCurrentMind(int cur_num, bool is_anime)
	{
		YotogiOldParamBasicBar.BarSet barSet = this.bar_dic_[YotogiOldParamBasicBar.Kind.Mind];
		barSet.num_label.text = cur_num.ToString();
		float num = (float)cur_num / (float)barSet.max;
		Color color;
		if ((double)num <= 0.3)
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Red];
		}
		else
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Blue];
		}
		barSet.gauge_trans.GetComponent<UISprite>().color = color;
		Vector3 vector = new Vector3(num, 1f, 1f);
		if (is_anime)
		{
			Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
			iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
		}
		else
		{
			barSet.gauge_trans.localScale = vector;
		}
	}

	public void SetCurrentReason(int cur_num, bool is_anime)
	{
		YotogiOldParamBasicBar.BarSet barSet = this.bar_dic_[YotogiOldParamBasicBar.Kind.Reason];
		barSet.num_label.text = cur_num.ToString();
		float num = (float)cur_num / (float)barSet.max;
		Color color;
		if ((double)num <= 0.3)
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Red];
		}
		else
		{
			color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Blue];
		}
		barSet.gauge_trans.GetComponent<UISprite>().color = color;
		Vector3 vector = new Vector3(num, 1f, 1f);
		if (is_anime)
		{
			Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
			iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
		}
		else
		{
			barSet.gauge_trans.localScale = vector;
		}
	}

	private Dictionary<YotogiOldParamBasicBar.Kind, YotogiOldParamBasicBar.BarSet> bar_dic_ = new Dictionary<YotogiOldParamBasicBar.Kind, YotogiOldParamBasicBar.BarSet>();

	private Dictionary<YotogiOldParamBasicBar.GageColor, Color> color_dic_ = new Dictionary<YotogiOldParamBasicBar.GageColor, Color>();

	protected Maid maid_;

	private enum Kind
	{
		Excite,
		Mind,
		Reason
	}

	private enum GageColor
	{
		Blue,
		Red,
		Yellow,
		Orange
	}

	private class BarSet
	{
		public Transform gauge_trans;

		public UILabel num_label;

		public int min;

		public int max;
	}
}
