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

public class DescResulteBase : MonoBehaviour
{
	public virtual void Init(ResultWorkMgr resultWorkMgr, ResultWorkCtrl ctrl, GameObject goPanel)
	{
		this.m_resultWorkMgr = resultWorkMgr;
		this.m_resultWorkCtrl = ctrl;
		this.m_goPanel = goPanel;
		this.viewPanel = base.gameObject;
		this.m_goMaidStatus = UTY.GetChildObject(this.viewPanel, "MaidStatus", false);
		this.m_goMaidParameterParent = UTY.GetChildObject(this.m_goMaidStatus, "ParameterParent", false);
		this.m_spBGOfMaidParameterViewer = UTY.GetChildObject(this.m_goMaidStatus, "BG", false).GetComponent<UISprite>();
		this.m_heightOfMaidParameterTitle = UTY.GetChildObject(this.m_goMaidStatus, "Title", false).GetComponent<UISprite>().height;
		this.m_lStudyRate = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "StudyRate");
		this.m_lReception = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Reception");
		this.m_lCare = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Care");
		this.m_lLovely = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Lovely");
		this.m_lElegance = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Elegance");
		this.m_lCharm = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Charm");
		this.m_lTeachRate = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "TeachRate");
		this.m_lCooking = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Cooking");
		this.m_lVocal = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Vocal");
		this.m_lDance = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Dance");
		this.m_lAppealPoint = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "AP");
		this.m_listMaidItem = new List<ScheduleCtrl.VariableItem>();
		this.m_listMaidItem.Add(this.m_lStudyRate.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lReception.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lCare.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lLovely.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lElegance.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lCharm.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lTeachRate.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lCooking.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lVocal.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lDance.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lAppealPoint.GetVariableItem());
		this.m_listAnimationTarget = new List<GameObject>();
		this.m_listAnimationTarget.Add(this.m_lStudyRate.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lReception.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lCare.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lLovely.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lElegance.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lCharm.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lTeachRate.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lCooking.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lVocal.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lDance.ValueObj);
		this.m_listAnimationTarget.Add(this.m_lAppealPoint.ValueObj);
	}

	public virtual void UpdateView(string buttonName)
	{
	}

	protected virtual void UpdateAddValue(ResultWorkCtrl.UpperMaidStatus maidStatus)
	{
		this.m_lStudyRate.AddValueText = this.Sign(maidStatus.studyRate);
		this.m_lReception.AddValueText = this.Sign(maidStatus.reception);
		this.m_lCare.AddValueText = this.Sign(maidStatus.care);
		this.m_lLovely.AddValueText = this.Sign(maidStatus.lovely);
		this.m_lElegance.AddValueText = this.Sign(maidStatus.elegance);
		this.m_lCharm.AddValueText = this.Sign(maidStatus.charm);
		this.m_lTeachRate.AddValueText = this.Sign(maidStatus.teach);
		this.m_lCooking.AddValueText = this.Sign(maidStatus.cooking);
		this.m_lVocal.AddValueText = this.Sign(maidStatus.vocal);
		this.m_lDance.AddValueText = this.Sign(maidStatus.dance);
		this.m_lAppealPoint.AddValueText = this.Sign(maidStatus.appealPoint);
	}

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

	public void SetResultWorkDic(Dictionary<string, ResultWorkCtrl.ResultWork> dicResultWork)
	{
		this.m_dicResultWork = dicResultWork;
	}

	protected ResultWorkCtrl.UpperMaidStatus GetMaidStatusBySlotNo(int slotNo)
	{
		ResultWorkCtrl.ResultWork resultWorkBySlotNo = this.m_resultWorkCtrl.GetResultWorkBySlotNo(slotNo);
		if (resultWorkBySlotNo.upperMaidStatus != null)
		{
			return resultWorkBySlotNo.upperMaidStatus;
		}
		return null;
	}

	protected string Sign(int input)
	{
		if (input > 0)
		{
			return "+" + input.ToString();
		}
		return input.ToString();
	}

	protected string Sign(long input, string format)
	{
		if (input > 0L)
		{
			return "+" + input.ToString(format);
		}
		return input.ToString(format);
	}

	protected void TweenAnimation(bool play)
	{
		foreach (GameObject gameObject in this.m_listAnimationTarget)
		{
			if (!(gameObject == null))
			{
				GameObject gameObject2 = gameObject.transform.parent.gameObject;
				if (gameObject2.activeSelf)
				{
					TweenScale tweenScale = gameObject.GetComponent<TweenScale>();
					if (tweenScale)
					{
						UnityEngine.Object.Destroy(tweenScale);
					}
					tweenScale = gameObject.AddComponent<TweenScale>();
					TweenColor tweenColor = gameObject.GetComponent<TweenColor>();
					if (tweenColor)
					{
						UnityEngine.Object.Destroy(tweenColor);
					}
					tweenColor = gameObject.AddComponent<TweenColor>();
					if (play)
					{
						tweenScale.from = Vector2.one;
						tweenScale.to = Vector2.one * this.scaleSizeCommuBonus;
						tweenScale.duration = this.scaleDurationCommuBonus;
						EventDelegate.Set(tweenScale.onFinished, new EventDelegate.Callback(tweenScale.PlayReverse));
						tweenScale.PlayForward();
						tweenColor.from = Color.white;
						tweenColor.to = Color.yellow;
						tweenColor.duration = this.colorDurationCommuBonus;
						EventDelegate.Set(tweenColor.onFinished, new EventDelegate.Callback(tweenColor.PlayReverse));
						tweenColor.PlayForward();
					}
					else
					{
						tweenScale.ResetToBeginning();
						tweenColor.ResetToBeginning();
					}
				}
			}
		}
	}

	[SerializeField]
	protected float scaleSizeCommuBonus = 1.3f;

	[SerializeField]
	protected float scaleDurationCommuBonus = 0.5f;

	[SerializeField]
	protected float colorDurationCommuBonus = 0.5f;

	public bool m_playedAnimation;

	protected ResultWorkMgr m_resultWorkMgr;

	protected ResultWorkCtrl m_resultWorkCtrl;

	protected GameObject m_goPanel;

	protected GameObject viewPanel;

	protected GameObject m_goMaidStatus;

	protected GameObject m_goMaidParameterParent;

	protected UISprite m_spBGOfMaidParameterViewer;

	protected List<ScheduleCtrl.VariableItem> m_listMaidItem;

	protected List<GameObject> m_listAnimationTarget;

	protected int m_heightOfMaidParameterTitle;

	protected bool m_bInit;

	protected Dictionary<string, ResultWorkCtrl.ResultWork> m_dicResultWork;

	protected DescResulteBase.ParamSet m_lCare;

	protected DescResulteBase.ParamSet m_lReception;

	protected DescResulteBase.ParamSet m_lStudyRate;

	protected DescResulteBase.ParamSet m_lTeachRate;

	protected DescResulteBase.ParamSet m_lLovely;

	protected DescResulteBase.ParamSet m_lElegance;

	protected DescResulteBase.ParamSet m_lCharm;

	protected DescResulteBase.ParamSet m_lCooking;

	protected DescResulteBase.ParamSet m_lVocal;

	protected DescResulteBase.ParamSet m_lDance;

	protected DescResulteBase.ParamSet m_lAppealPoint;

	public class ParamSet
	{
		public ParamSet(GameObject parent, string childObjName)
		{
			this.baseObj = UTY.GetChildObject(parent, childObjName, true);
			if (this.baseObj == null)
			{
				return;
			}
			this.valueObj = UTY.GetChildObject(this.baseObj, "Value", true);
			if (this.valueObj != null)
			{
				this.addValue = this.valueObj.GetComponent<UILabel>();
			}
		}

		public GameObject ValueObj
		{
			get
			{
				return this.valueObj;
			}
		}

		public string AddValueText
		{
			set
			{
				if (this.addValue != null)
				{
					this.addValue.text = value;
				}
			}
		}

		public ScheduleCtrl.VariableItem GetVariableItem()
		{
			return new ScheduleCtrl.VariableItem(this.baseObj, this.addValue);
		}

		private GameObject baseObj;

		private GameObject valueObj;

		private UILabel addValue;
	}
}
