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

public class StatusMgr : BaseCreatePanel
{
	public override void Init()
	{
		this.m_goPanel = base.GetPanel("StatusPanel");
		this.m_ctrl = base.GetCtrl<StatusCtrl>();
		this.m_ctrl.Init(this, this.m_goPanel);
		this.m_goPanel.SetActive(false);
	}

	public void OpenStatusPanel()
	{
		Debug.Log("ステータスをオープンしました。");
		base.SetDurationToFadeIn(0f);
		base.SetDurationToFadeOut(0f);
		base.BaseOpenPanel();
	}

	public void UpdateMaidStatus(Maid maid)
	{
		this.m_maid = maid;
		StatusCtrl.Status status = this.LoadData();
		this.m_ctrl.CreateViewer(status);
	}

	protected override void OpenPanel()
	{
	}

	public void CloseStatusPanel()
	{
		base.BaseClosePanel();
	}

	protected override void AfterClose()
	{
		if (this.sceneMgr != null)
		{
			this.sceneMgr.CloseScene();
		}
	}

	protected override void SetFadeTargetPanel()
	{
		this.fadeTargetPanel = this.m_goPanel;
	}

	private StatusCtrl.Status LoadData()
	{
		StatusCtrl.Status status = new StatusCtrl.Status();
		status.maidIcon = this.m_maid.GetThumIcon();
		status.firstName = this.m_maid.status.firstName;
		status.lastName = this.m_maid.status.lastName;
		status.contractType = EnumConvert.GetString(this.m_maid.status.contract);
		status.personal = this.m_maid.status.personal.drawName;
		status.sexualExperience = EnumConvert.GetString(this.m_maid.status.seikeiken);
		ClassData<JobClass.Data> selectedJobClass = this.m_maid.status.selectedJobClass;
		if (selectedJobClass != null)
		{
			status.maidClassName = selectedJobClass.data.drawName;
			status.maidClassLevel = selectedJobClass.level;
			status.maidClassExp = selectedJobClass.cur_exp;
			status.maidClassRequiredExp = selectedJobClass.next_exp;
		}
		ClassData<YotogiClass.Data> selectedYotogiClass = this.m_maid.status.selectedYotogiClass;
		if (selectedYotogiClass != null)
		{
			status.yotogiClassName = selectedYotogiClass.data.drawName;
			status.yotogiClassLevel = selectedYotogiClass.level;
			status.yotogiClassExp = selectedYotogiClass.cur_exp;
			status.yotogiClassRequiredExp = selectedYotogiClass.next_exp;
		}
		status.height = this.m_maid.status.body.height;
		status.weight = this.m_maid.status.body.weight;
		status.bust = this.m_maid.status.body.bust;
		status.cup = this.m_maid.status.body.cup;
		status.waist = this.m_maid.status.body.waist;
		status.hip = this.m_maid.status.body.hip;
		status.hp = this.m_maid.status.maxHp;
		status.mind = this.m_maid.status.maxMind;
		status.likability = this.m_maid.status.likability;
		status.care = this.m_maid.status.care;
		status.reception = this.m_maid.status.reception;
		status.cooking = this.m_maid.status.cooking;
		status.dance = this.m_maid.status.dance;
		status.vocal = this.m_maid.status.vocal;
		status.appeal = this.m_maid.status.maxAppealPoint;
		status.studyRate = this.m_maid.status.studyRate;
		status.teachRate = this.m_maid.status.teachRate;
		status.lovely = this.m_maid.status.lovely;
		status.elegance = this.m_maid.status.elegance;
		status.charm = this.m_maid.status.charm;
		status.inran = this.m_maid.status.inyoku;
		status.mValue = this.m_maid.status.mvalue;
		status.hentai = this.m_maid.status.hentai;
		status.housi = this.m_maid.status.housi;
		status.relation = EnumConvert.GetString(this.m_maid.status.relation);
		if (this.m_maid.status.OldStatus != null)
		{
			if (this.m_maid.status.OldStatus.isMarriage)
			{
				status.relation = "嫁";
			}
			if (this.m_maid.status.OldStatus.isNewWife)
			{
				status.relation = "新妻";
			}
		}
		status.conditionText = this.m_maid.status.conditionText;
		status.yotogiPlayCount = this.m_maid.status.playCountYotogi;
		status.othersPlayCount = this.m_maid.status.playCountNightWork;
		status.ranking = this.m_maid.status.popularRank;
		status.acquisitionOfClientEvaluation = this.m_maid.status.totalEvaluations;
		status.acquisitionOfWorkingFunds = this.m_maid.status.totalSales;
		status.daysOfEmployment = this.m_maid.status.employmentElapsedDay;
		if (this.m_maid.status.heroineType == HeroineType.Sub)
		{
			SubMaid.Data.CharacterStatus subCharaStatus = this.m_maid.status.subCharaStatus;
			status.contractType = subCharaStatus.contractText;
			status.personal = subCharaStatus.personalText;
		}
		if (this.m_maid.status.OldStatus != null)
		{
			status.mouth = this.m_maid.status.OldStatus.sexual.mouth;
			status.throat = this.m_maid.status.OldStatus.sexual.throat;
			status.nipple = this.m_maid.status.OldStatus.sexual.nipple;
			status.curi = this.m_maid.status.OldStatus.sexual.curi;
		}
		return status;
	}

	protected StatusCtrl m_ctrl;

	protected Maid m_maid;

	protected Dictionary<int, string> m_dicCrownIcon;
}
