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

public class AttributeViewer : MonoBehaviour
{
	public void Awake()
	{
		if (this.seiheki_table_ != null)
		{
			return;
		}
		this.updateStatusInfo = false;
		this.seiheki_table_ = UTY.GetChildObject(base.gameObject, "Contents/Attribute/AttributeUnitParent", false).GetComponent<UITable>();
		List<Transform> childList = this.seiheki_table_.GetChildList();
		for (int i = 0; i < childList.Count; i++)
		{
			childList[i].gameObject.SetActive(false);
		}
		this.seiheki_table_.Reposition();
	}

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

	public void UpdateStatusInfo()
	{
		this.Awake();
		if (this.updateStatusInfo)
		{
			return;
		}
		this.updateStatusInfo = true;
		Status status = GameMain.Instance.CharacterMgr.GetMaid(0).status;
		List<Transform> childList = this.seiheki_table_.GetChildList();
		for (int i = 0; i < childList.Count; i++)
		{
			childList[i].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;
				Localize component = componentInChildren.GetComponent<Localize>();
				component.SetTerm(data.termName);
				num++;
			}
		}
	}

	private Maid maid_;

	private UITable seiheki_table_;

	private bool updateStatusInfo;
}
