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

public class YotogiOldParameterViewer : MonoBehaviour
{
	private void Awake()
	{
		GameObject childObject = UTY.GetChildObject(base.gameObject, string.Empty, false);
		GameObject find_target = null;
		Func<string, UILabel> func = (string find_name) => UTY.GetChildObject(find_target, find_name, false).GetComponent<UILabel>();
		find_target = childObject;
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Contract, func("ContractType/Name"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Name, func("MaidName/Name"));
		find_target = UTY.GetChildObject(childObject, "YotogiClass", false);
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.YotogiClass, func("Name"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.YotogiClassLv, func("Level/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.YotogiClassCurExp, func("Exp/Exp"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.YotogiClassNextExp, func("Exp/RequiredExp"));
		find_target = UTY.GetChildObject(childObject, "NumberGroup/firstGroup", false);
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.YotogiPlayCount, func("YotogiPlayCount/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.OthersPlayCount, func("OthersPlayCount/Value"));
		find_target = UTY.GetChildObject(childObject, "NumberGroup/secondGroup", false);
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Hp, func("Hp/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Likability, func("Likability/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Reason, func("Reason/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Mind, func("Mind/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Lovely, func("Lovely/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Elegance, func("Elegance/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Charm, func("Charm/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Housi, func("Housi/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Inyoku, func("Inyoku/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.MValue, func("MValue/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.Hentai, func("Hentai/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.StudyRate, func("StudyRate/Value"));
		this.label_dictionary_.Add(YotogiOldParameterViewer.LabelType.TeachRate, func("TeachRate/Value"));
		this.bg_sprite_ = UTY.GetChildObject(base.gameObject, "BG", false).GetComponent<UISprite>();
		this.costume_button_obj_ = UTY.GetChildObject(base.gameObject, "ChangeCostume", false);
		this.SetCostumeButtonVisible(this.CostumeButtonVisible);
	}

	public void SetMaid(Maid maid)
	{
		this.maid_ = maid;
		if (this.AttributeViewer != null)
		{
			AttributeViewerOld component = this.AttributeViewer.GetComponent<AttributeViewerOld>();
			component.SetMaid(this.maid_);
		}
	}

	public void UpdateTextCommon()
	{
		if (this.maid_ == null)
		{
			return;
		}
		Status status = this.maid_.status;
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Contract].text = EnumConvert.GetString(status.contract);
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Name].text = status.lastName + "\n" + status.firstName;
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiPlayCount].text = status.playCountYotogi.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.OthersPlayCount].text = status.playCountNightWork.ToString();
		if (status.selectedYotogiClass != null)
		{
			ClassData<YotogiClass.Data> selectedYotogiClass = status.selectedYotogiClass;
			this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClass].text = selectedYotogiClass.data.drawName;
			this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClassLv].text = selectedYotogiClass.level.ToString();
			this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClassCurExp].text = selectedYotogiClass.cur_exp.ToString();
			this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClassNextExp].text = selectedYotogiClass.next_exp.ToString();
		}
		else
		{
			UILabel uilabel = this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClass];
			string text = string.Empty;
			this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClassNextExp].text = text;
			text = text;
			this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClassCurExp].text = text;
			text = text;
			this.label_dictionary_[YotogiOldParameterViewer.LabelType.YotogiClassLv].text = text;
			uilabel.text = text;
		}
	}

	public void UpdateTextParam()
	{
		if (this.maid_ == null)
		{
			return;
		}
		Status status = this.maid_.status;
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Hp].text = ((!this.CurrentValueDraw) ? status.maxHp.ToString() : status.currentHp.ToString());
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Likability].text = status.likability.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Reason].text = ((!this.CurrentValueDraw) ? status.maxReason.ToString() : status.currentReason.ToString());
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Mind].text = ((!this.CurrentValueDraw) ? status.maxMind.ToString() : status.currentMind.ToString());
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Lovely].text = status.lovely.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Elegance].text = status.elegance.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Charm].text = status.charm.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Housi].text = status.housi.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Inyoku].text = status.inyoku.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.MValue].text = status.mvalue.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.Hentai].text = status.hentai.ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.StudyRate].text = (status.studyRate / 10).ToString();
		this.label_dictionary_[YotogiOldParameterViewer.LabelType.TeachRate].text = (status.teachRate / 10).ToString();
	}

	public void SetCostumeButtonVisible(bool set_visible)
	{
		if (set_visible)
		{
			this.bg_sprite_.SetDimensions(this.bg_sprite_.width, 900);
			this.costume_button_obj_.SetActive(true);
		}
		else
		{
			this.bg_sprite_.SetDimensions(this.bg_sprite_.width, 850);
			this.costume_button_obj_.SetActive(false);
		}
	}

	public void SetAttributeViewer(GameObject obj)
	{
		this.AttributeViewer = obj;
		AttributeViewerOld component = this.AttributeViewer.GetComponent<AttributeViewerOld>();
		component.SetMaid(this.maid_);
		this.AttributeViewer.SetActive(false);
	}

	public void OnHoverOver()
	{
		this.AttributeViewer.SetActive(true);
	}

	public void OnHoverOut()
	{
		this.AttributeViewer.SetActive(false);
	}

	public UIButton costume_button
	{
		get
		{
			return this.costume_button_obj_.GetComponent<UIButton>();
		}
	}

	public Dictionary<YotogiOldParameterViewer.LabelType, UILabel> label_dictionary
	{
		get
		{
			return this.label_dictionary_;
		}
	}

	public bool CostumeButtonVisible = true;

	public GameObject AttributeViewer;

	public bool CurrentValueDraw;

	private Dictionary<YotogiOldParameterViewer.LabelType, UILabel> label_dictionary_ = new Dictionary<YotogiOldParameterViewer.LabelType, UILabel>();

	private Maid maid_;

	private UISprite bg_sprite_;

	private GameObject costume_button_obj_;

	public enum LabelType
	{
		Contract,
		Name,
		YotogiClass,
		YotogiClassLv,
		YotogiClassCurExp,
		YotogiClassNextExp,
		YotogiPlayCount,
		OthersPlayCount,
		Hp,
		Likability,
		Reason,
		Mind,
		Lovely,
		Elegance,
		Charm,
		Housi,
		Inyoku,
		MValue,
		Hentai,
		StudyRate,
		TeachRate
	}
}
