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

public class YotogiParameterViewer : 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(YotogiParameterViewer.LabelType.Contract, func("ContractType/Name"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Name, func("MaidName/Name"));
		find_target = UTY.GetChildObject(childObject, "YotogiClass", false);
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClass, func("Name"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClassLv, func("Level/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClassCurExp, func("Exp/Exp"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClassNextExp, func("Exp/RequiredExp"));
		find_target = UTY.GetChildObject(childObject, "NumberGroup", false);
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Seikeiken, func("Seikeiken/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Relation, func("Grid1/Relation/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.ConditionText, func("Grid1/conditionText/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Likability, func("Grid1/Likability/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.StudyRate, func("Grid1/StudyRate/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Hp, func("Grid2/Hp/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Mind, func("Grid2/Mind/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Inyoku, func("Grid2/Inyoku/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.MValue, func("Grid2/MValue/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Hentai, func("Grid2/Hentai/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Housi, func("Grid2/Housi/Value"));
		this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiPlayCount, func("YotogiPlayCount/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;
	}

	public void UpdateTextCommon()
	{
		if (this.maid_ == null)
		{
			return;
		}
		Status status = this.maid_.status;
		this.label_dictionary_[YotogiParameterViewer.LabelType.Contract].GetComponent<Localize>().SetTerm(EnumConvert.GetTerm(status.contract));
		this.label_dictionary_[YotogiParameterViewer.LabelType.Name].text = status.lastName + "\n" + status.firstName;
		this.label_dictionary_[YotogiParameterViewer.LabelType.YotogiPlayCount].text = status.playCountYotogi.ToString();
		this.label_dictionary_[YotogiParameterViewer.LabelType.Seikeiken].GetComponent<Localize>().SetTerm(EnumConvert.GetTerm(status.seikeiken));
		this.label_dictionary_[YotogiParameterViewer.LabelType.Relation].GetComponent<Localize>().SetTerm(EnumConvert.GetTerm(status.relation));
		this.label_dictionary_[YotogiParameterViewer.LabelType.ConditionText].GetComponent<Localize>().SetTerm(status.conditionTermText);
		UIWidget component = UTY.GetChildObject(this.label_dictionary_[YotogiParameterViewer.LabelType.ConditionText].transform.parent.gameObject, "Line", false).GetComponent<UIWidget>();
	}

	public void UpdateTextParam()
	{
		if (this.maid_ == null)
		{
			return;
		}
		Status status = this.maid_.status;
		this.label_dictionary_[YotogiParameterViewer.LabelType.Likability].text = status.likability.ToString();
		this.label_dictionary_[YotogiParameterViewer.LabelType.Hp].text = ((!this.CurrentValueDraw) ? status.maxHp.ToString() : status.currentHp.ToString());
		this.label_dictionary_[YotogiParameterViewer.LabelType.Mind].text = ((!this.CurrentValueDraw) ? status.maxMind.ToString() : status.currentMind.ToString());
		this.label_dictionary_[YotogiParameterViewer.LabelType.Inyoku].text = status.inyoku.ToString();
		this.label_dictionary_[YotogiParameterViewer.LabelType.MValue].text = status.mvalue.ToString();
		this.label_dictionary_[YotogiParameterViewer.LabelType.Hentai].text = status.hentai.ToString();
		this.label_dictionary_[YotogiParameterViewer.LabelType.Housi].text = status.housi.ToString();
		this.label_dictionary_[YotogiParameterViewer.LabelType.StudyRate].text = (status.studyRate / 10).ToString();
	}

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

	public void SetAttributeViewer(GameObject obj)
	{
		this.AttributeViewer = obj;
		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<YotogiParameterViewer.LabelType, UILabel> label_dictionary
	{
		get
		{
			return this.label_dictionary_;
		}
	}

	public bool CostumeButtonVisible = true;

	public GameObject AttributeViewer;

	public bool CurrentValueDraw;

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

	private Maid maid_;

	private UISprite bg_sprite_;

	private GameObject costume_button_obj_;

	public enum LabelType
	{
		Contract,
		Name,
		YotogiClass,
		YotogiClassLv,
		YotogiClassCurExp,
		YotogiClassNextExp,
		YotogiPlayCount,
		Seikeiken,
		Relation,
		ConditionText,
		Likability,
		Hp,
		Mind,
		Inyoku,
		MValue,
		Hentai,
		Housi,
		StudyRate
	}
}
