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

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 || this.targetMaid == null)
		{
			return;
		}
		this.updateStatusInfo = true;
		Status status = this.targetMaid.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;
				Utility.SetLocalizeTerm(componentInChildren, data.termName, false);
				num++;
			}
		}
	}

	[SerializeField]
	public Maid targetMaid;

	private UITable seiheki_table_;

	private bool updateStatusInfo;
}
