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

public class DescScheduleYotogi : DescScheduleBase
{
	public override void Init(ScheduleTaskCtrl taskCtrl)
	{
		base.Init(taskCtrl);
		this.m_lReception = new DescScheduleBase.ParamSet(this.m_goMaidParameterParent, "Reception", true);
		this.m_lCare = new DescScheduleBase.ParamSet(this.m_goMaidParameterParent, "Care", true);
		this.m_lTeachRate = new DescScheduleBase.ParamSet(this.m_goMaidParameterParent, "TeachRate", true);
		this.m_lInyoku = new DescScheduleBase.ParamSet(this.m_goMaidParameterParent, "Inyoku", true);
		this.m_lMvalue = new DescScheduleBase.ParamSet(this.m_goMaidParameterParent, "Mvalue", true);
		this.m_lHentai = new DescScheduleBase.ParamSet(this.m_goMaidParameterParent, "Hentai", true);
		this.m_lHousi = new DescScheduleBase.ParamSet(this.m_goMaidParameterParent, "Housi", true);
		this.m_listMaidItem.Add(this.m_lReception.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lCare.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lTeachRate.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lInyoku.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lMvalue.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lHentai.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lHousi.GetVariableItem());
		this.explanation_label_ = UTY.GetChildObject(base.gameObject, "Description/Message", false).GetComponent<UILabel>();
		this.condition_parent = UTY.GetChildObject(base.gameObject, "Condition/ConditionParent", false);
		for (int i = 0; i < 9; i++)
		{
			GameObject gameObject = Utility.CreatePrefab(this.condition_parent, "SceneDaily/Schedule/Prefab/ConditionUnit", true);
			gameObject.transform.localPosition = new Vector3(0f, (float)(i * 10), 0f);
			UTY.GetChildObject(gameObject, "No", false).GetComponent<UILabel>().text = (i + 1).ToString();
			KeyValuePair<GameObject, UILabel> item = new KeyValuePair<GameObject, UILabel>(gameObject, UTY.GetChildObject(gameObject, "Message", false).GetComponent<UILabel>());
			this.condition_unit_label_.Add(item);
		}
		DescScheduleBase.Reposition(this.condition_parent);
	}

	protected override void UpdateCurentValue()
	{
		Slot slot = this.taskCtrl.ScheduleMgr.GetScheduleApi().slot[this.taskCtrl.CurrentActiveSlotNo];
		Maid maid = slot.maid;
		if (maid == null)
		{
			return;
		}
		this.m_lReception.CurrentValueText = maid.status.reception.ToString();
		this.m_lCare.CurrentValueText = maid.status.care.ToString();
		this.m_lTeachRate.CurrentValueText = (maid.status.teachRate / 10).ToString();
		this.m_lInyoku.CurrentValueText = maid.status.inyoku.ToString();
		this.m_lMvalue.CurrentValueText = maid.status.mvalue.ToString();
		this.m_lHentai.CurrentValueText = maid.status.hentai.ToString();
		this.m_lHousi.CurrentValueText = maid.status.housi.ToString();
	}

	private void UpdateAddValue(ScheduleCSVData.Yotogi data)
	{
		this.m_lReception.AddValueText = base.Sign(data.easyYotogi.reception, null);
		this.m_lCare.AddValueText = base.Sign(data.easyYotogi.care, null);
		this.m_lTeachRate.AddValueText = base.Sign(data.easyYotogi.teach_rate, null);
		this.m_lInyoku.AddValueText = base.Sign(data.easyYotogi.inyoku, null);
		this.m_lMvalue.AddValueText = base.Sign(data.easyYotogi.msei, null);
		this.m_lHentai.AddValueText = base.Sign(data.easyYotogi.hentai, null);
		this.m_lHousi.AddValueText = base.Sign(data.easyYotogi.housi, null);
	}

	protected override void UpdateView(ScheduleCSVData.ScheduleBase work_data)
	{
		ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)work_data;
		base.Active(true);
		this.explanation_label_.text = yotogi.information;
		int num = 0;
		for (int i = 0; i < this.condition_unit_label_.Count; i++)
		{
			if (i < yotogi.condInfo.Count)
			{
				this.condition_unit_label_[i].Key.SetActive(true);
				this.condition_unit_label_[i].Value.text = yotogi.condInfo[i];
				num++;
			}
			else
			{
				this.condition_unit_label_[i].Key.SetActive(false);
			}
		}
		float num2 = 260f;
		float num3 = 10f;
		float num4 = 25f;
		float num5 = 4f;
		float num6 = 0f;
		GameObject childObject = UTY.GetChildObject(base.gameObject, "Condition/Title", false);
		if (0 < num)
		{
			childObject.SetActive(true);
			num6 += (float)(childObject.GetComponent<UISprite>().height / 2) + num3;
			float y = UTY.GetChildObject(base.gameObject, "Condition/ConditionParent", false).GetComponent<UITable>().padding.y;
			Transform parent = this.condition_unit_label_[0].Key.transform.parent;
			IEnumerator enumerator = parent.transform.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					if (transform.gameObject.activeSelf)
					{
						UILabel component = transform.Find("Message").GetComponent<UILabel>();
						num6 += (float)component.height + y * 2f + num5;
					}
				}
			}
			finally
			{
				IDisposable disposable;
				if ((disposable = (enumerator as IDisposable)) != null)
				{
					disposable.Dispose();
				}
			}
			num6 += num4;
		}
		else
		{
			childObject.SetActive(false);
		}
		DescScheduleBase.Reposition(this.condition_parent);
		UTY.GetChildObject(base.gameObject, "BG", false).GetComponent<UISprite>().height = (int)(num2 + num6);
		if (yotogi.easyYotogi != null)
		{
			this.m_goMaidParameter.SetActive(true);
			this.UpdateCurentValue();
			this.UpdateAddValue(yotogi);
			base.ExamineDisplayItem();
		}
		else
		{
			this.m_goMaidParameter.SetActive(false);
		}
	}

	private UILabel explanation_label_;

	private List<KeyValuePair<GameObject, UILabel>> condition_unit_label_ = new List<KeyValuePair<GameObject, UILabel>>();

	private GameObject condition_parent;

	protected DescScheduleBase.ParamSet m_lCare;

	protected DescScheduleBase.ParamSet m_lReception;

	protected DescScheduleBase.ParamSet m_lTeachRate;

	protected DescScheduleBase.ParamSet m_lInyoku;

	protected DescScheduleBase.ParamSet m_lMvalue;

	protected DescScheduleBase.ParamSet m_lHentai;

	protected DescScheduleBase.ParamSet m_lHousi;

	protected DescScheduleBase.ParamSet m_lYotogiCnt;
}
