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

public class AttributeViewerOld : MonoBehaviour
{
	public void Awake()
	{
		if (this.seikantai_list_.Count != 0)
		{
			return;
		}
		GameObject childObject = UTY.GetChildObject(base.gameObject, "Contents/ErogenousZone/ErogenousZoneParent", false);
		string[] array = new string[]
		{
			"口",
			"喉",
			"乳首",
			"クリトリス"
		};
		for (int i = 0; i < array.Length; i++)
		{
			AttributeViewerOld.SeikantaiObject item = default(AttributeViewerOld.SeikantaiObject);
			GameObject gameObject = childObject.transform.GetChild(i).gameObject;
			item.gage = UTY.GetChildObject(gameObject, "Gauge", false).transform;
			item.percent_label = UTY.GetChildObject(gameObject, "Number/Value", false).GetComponent<UILabel>();
			this.seikantai_list_.Add(item);
		}
		this.seiheki_table_ = UTY.GetChildObject(base.gameObject, "Contents/Attribute/AttributeUnitParent", false).GetComponent<UITable>();
		List<Transform> childList = this.seiheki_table_.GetChildList();
		for (int j = 0; j < childList.Count; j++)
		{
			childList[j].gameObject.SetActive(false);
		}
		this.seiheki_table_.Reposition();
	}

	public void OnEnable()
	{
		this.Awake();
		this.UpdateStatusInfo();
	}

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

	public void UpdateStatusInfo()
	{
		this.Awake();
		if (this.maid_ == null)
		{
			return;
		}
		Status status = this.maid_.status;
		int[] array = new int[]
		{
			status.OldStatus.sexual.mouth,
			status.OldStatus.sexual.throat,
			status.OldStatus.sexual.nipple,
			status.OldStatus.sexual.curi
		};
		NDebug.Assert(array.Length == this.seikantai_list_.Count, "error");
		for (int i = 0; i < this.seikantai_list_.Count; i++)
		{
			AttributeViewerOld.SeikantaiObject seikantaiObject = this.seikantai_list_[i];
			seikantaiObject.gage.transform.localScale = new Vector2((float)array[i] / 1000f, 1f);
			seikantaiObject.percent_label.text = (array[i] / 10).ToString();
		}
		List<Transform> childList = this.seiheki_table_.GetChildList();
		for (int j = 0; j < childList.Count; j++)
		{
			childList[j].gameObject.SetActive(false);
		}
		int num = 0;
		foreach (Propensity.Data data in status.propensitys.GetValueArray())
		{
			if (childList.Count <= num)
			{
				break;
			}
			childList[num].gameObject.SetActive(true);
			UILabel componentInChildren = childList[num].gameObject.GetComponentInChildren<UILabel>();
			if (!(componentInChildren == null))
			{
				componentInChildren.text = data.drawName;
				num++;
			}
		}
	}

	private Maid maid_;

	private List<AttributeViewerOld.SeikantaiObject> seikantai_list_ = new List<AttributeViewerOld.SeikantaiObject>();

	private UITable seiheki_table_;

	private struct SeikantaiObject
	{
		public Transform gage;

		public UILabel percent_label;
	}
}
