using System;
using UnityEngine;

public class DescResultYotogi : DescResulteBase
{
	public override void Init(ResultWorkMgr resultWorkMgr, ResultWorkCtrl ctrl, GameObject goPanel)
	{
		base.Init(resultWorkMgr, ctrl, goPanel);
		GameObject gameObject = base.gameObject;
		this.m_goResultYotogi = UTY.GetChildObject(gameObject, "MaidStatus", false);
		this.m_lHousi = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Housi");
		this.m_lInran = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Inran");
		this.m_lMValue = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "MValue");
		this.m_lHentai = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Hentai");
		this.m_lYotogiClassLevel = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "YotogiClassLevel");
		this.m_lYotogiClassExp = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "YotogiClassExp");
		this.m_lYotogiPlayCount = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "YotogiPlayCount");
		this.m_lOthersPlayCount = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "OthersPlayCount");
		this.m_goIndividualEvaluation = UTY.GetChildObject(gameObject, "IndividualEvaluation", false);
		this.m_lAcquisitionOfClientEvaluation = new DescResulteBase.ParamSet(this.m_goIndividualEvaluation, "AcquisitionOfClientEvaluation");
		this.m_lAcquisitionOfWorkingFunds = new DescResulteBase.ParamSet(this.m_goIndividualEvaluation, "AcquisitionOfWorkingFunds");
		this.m_listMaidItem.Add(this.m_lHousi.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lInran.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lMValue.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lHentai.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lYotogiClassLevel.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lYotogiClassExp.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lYotogiPlayCount.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lOthersPlayCount.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lAcquisitionOfClientEvaluation.GetVariableItem());
		this.m_listMaidItem.Add(this.m_lAcquisitionOfWorkingFunds.GetVariableItem());
		this.m_spBGOfParameterViewer = UTY.GetChildObject(this.m_goResultYotogi, "BG", false).GetComponent<UISprite>();
		GameObject childObject = UTY.GetChildObject(this.m_goResultYotogi, "Title", false);
		this.m_heightOfMaidParameterTitle = childObject.GetComponent<UISprite>().height;
		base.gameObject.SetActive(false);
	}

	public override void UpdateView(string buttonName)
	{
		this.m_resultWorkCtrl.SetSelectedRowActive(buttonName);
		int slotNoByButtonName = ScheduleCtrl.GetSlotNoByButtonName(buttonName);
		ResultWorkCtrl.ResultWork resultWorkBySlotNo = this.m_resultWorkCtrl.GetResultWorkBySlotNo(slotNoByButtonName);
		if (resultWorkBySlotNo.hasResult)
		{
			this.LoadResultNightStatus(slotNoByButtonName);
		}
		else
		{
			Debug.LogWarning(string.Format("スロットNo={0}には仕事の結果データが存在しません。", slotNoByButtonName));
		}
		base.ActivePanel(true);
	}

	private void LoadResultNightStatus(int slotNo)
	{
		this.SetStatusViewer(true);
		ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = base.GetMaidStatusBySlotNo(slotNo);
		if (maidStatusBySlotNo != null)
		{
			this.SetMaxYotogiClassLevelIcon(slotNo, maidStatusBySlotNo.yotogiLvCompletion);
			this.UpdateAddValue(maidStatusBySlotNo);
			bool active = this.ExamineDisplayItem();
			this.m_goResultYotogi.SetActive(active);
		}
		else
		{
			this.SetStatusViewer(false);
		}
	}

	protected override void UpdateAddValue(ResultWorkCtrl.UpperMaidStatus maidStatus)
	{
		base.UpdateAddValue(maidStatus);
		this.m_lAcquisitionOfClientEvaluation.AddValueText = base.Sign(maidStatus.evaluation);
		this.m_lAcquisitionOfWorkingFunds.AddValueText = base.Sign(maidStatus.income, "#,0");
		this.m_lInran.AddValueText = base.Sign(maidStatus.inyoku);
		this.m_lMValue.AddValueText = base.Sign(maidStatus.m_value);
		this.m_lHentai.AddValueText = base.Sign(maidStatus.hentai);
		this.m_lHousi.AddValueText = base.Sign(maidStatus.housi);
		this.m_lYotogiClassLevel.AddValueText = base.Sign(maidStatus.yotogiClassLevel);
		this.m_lYotogiClassExp.AddValueText = base.Sign(maidStatus.yotogiClassExp);
		this.m_lYotogiPlayCount.AddValueText = base.Sign(maidStatus.yotogiPlayCount);
		this.m_lOthersPlayCount.AddValueText = base.Sign(maidStatus.othersPlayCount);
	}

	private void SetMaxYotogiClassLevelIcon(int slotNo, bool reachMaxLevel)
	{
		string key = slotNo.ToString();
		if (this.m_dicResultWork.ContainsKey(key))
		{
			ResultWorkCtrl.ResultWork resultWork = this.m_dicResultWork[key];
			resultWork.goIconYotogiClassMax.SetActive(reachMaxLevel);
		}
		else
		{
			Debug.LogError(string.Format("不適切なスロットNoが選択されました。選択されたスロットNo=", slotNo + 1));
		}
	}

	private bool ExamineDisplayItem()
	{
		int num = ScheduleCtrl.SetActiveExceptForNothing(this.m_listMaidItem, "0");
		if (num == 0)
		{
			return false;
		}
		BaseCreateViewerCtrl.Reposition(this.m_goMaidParameterParent);
		this.m_resultWorkCtrl.AdjustParameterViewer(this.m_goMaidParameterParent, num, this.m_heightOfMaidParameterTitle, this.m_spBGOfParameterViewer);
		return true;
	}

	private void SetStatusViewer(bool active)
	{
		this.m_goIndividualEvaluation.SetActive(active);
		this.m_goResultYotogi.SetActive(active);
	}

	private GameObject m_goIndividualEvaluation;

	private GameObject m_goResultYotogi;

	private UISprite m_spBGOfParameterViewer;

	private DescResulteBase.ParamSet m_lHousi;

	private DescResulteBase.ParamSet m_lInran;

	private DescResulteBase.ParamSet m_lMValue;

	private DescResulteBase.ParamSet m_lHentai;

	private DescResulteBase.ParamSet m_lYotogiClassLevel;

	private DescResulteBase.ParamSet m_lYotogiClassExp;

	private DescResulteBase.ParamSet m_lYotogiPlayCount;

	private DescResulteBase.ParamSet m_lOthersPlayCount;

	private DescResulteBase.ParamSet m_lAcquisitionOfClientEvaluation;

	private DescResulteBase.ParamSet m_lAcquisitionOfWorkingFunds;
}
