using System;
using System.Collections.Generic;
using Schedule;
using UnityEngine;

public class MaidStatusListCtrl : MonoBehaviour
{
	public void Init(ScheduleMgr scheduleMgr, ScheduleCtrl scheduleCtrl, GameObject goPanel)
	{
		this.m_scheduleMgr = scheduleMgr;
		this.m_scheduleCtrl = scheduleCtrl;
		this.m_goMaidStatusListViewer = UTY.GetChildObject(goPanel, "CharacterSelectPanel", false);
		this.m_goMaidStatusListViewer.SetActive(false);
		this.m_charSelMgr = UTY.GetChildObject(goPanel, "CharacterSelectPanel", false).GetComponent<CharacterSelectManager>();
	}

	public void CreateTaskViewer(string buttonName)
	{
		this.m_scheduleCtrl.SetMaidIdByButtonName(buttonName);
		this.m_scheduleCtrl.SetSelectedRowActive(buttonName);
		this.m_scheduleCtrl.SetViewerActive(ScheduleCtrl.ExclusiveViewer.MaidStatusList);
		this.m_charSelMgr.SetCallBackOnClick(new CharacterSelectManager.CallBackOnClick(this.m_scheduleMgr.ClickMaidStatusInListViewer));
		this.m_charSelMgr.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
		{
			List<Maid> list = new List<Maid>();
			CharacterSelectManager.DefaultMaidList(list);
			for (int i = 0; i < list.Count; i++)
			{
				Maid maid = list[i];
				if (!DailyMgr.IsLegacy || maid.status.isCompatiblePersonality)
				{
					draw_maid_list.Add(list[i]);
				}
			}
		});
		this.m_charSelMgr.Create(CharacterSelectManager.Type.Click, 3, true);
		this.RemoveMaidInSlot();
	}

	private void RemoveMaidInSlot()
	{
		Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> dicMaidStatusAndTask = this.m_scheduleCtrl.GetDicMaidStatusAndTask();
		foreach (KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit> keyValuePair in dicMaidStatusAndTask)
		{
			ScheduleCtrl.MaidStatusAndTaskUnit value = keyValuePair.Value;
			this.m_charSelMgr.MoveNoDrawArea(value.maidStatus.maid);
		}
	}

	public void MoveMaidToSlot(ScheduleScene scheduleApi, Maid maidToMoveInSlot)
	{
		string currentActiveButton = this.m_scheduleMgr.CurrentActiveButton;
		int slotId = ScheduleCtrl.ToIntSlotNo(this.m_scheduleCtrl.GetActiveSlotNo());
		scheduleApi.SetSlot_Safe(slotId, maidToMoveInSlot, true, true);
		this.m_charSelMgr.MoveNoDrawArea(maidToMoveInSlot);
		Maid maidByActiveSlot = this.m_scheduleCtrl.GetMaidByActiveSlot();
		if (maidByActiveSlot != null)
		{
			this.m_charSelMgr.MoveGridArea(maidByActiveSlot);
		}
		this.m_scheduleMgr.UpdateMaidStatus();
		this.m_scheduleCtrl.SetSelectedRowActive(currentActiveButton);
		this.m_scheduleMgr.CurrentActiveButton = currentActiveButton;
		this.m_scheduleCtrl.SetViewerActive(ScheduleCtrl.ExclusiveViewer.MaidStatusList);
	}

	private ScheduleMgr m_scheduleMgr;

	private ScheduleCtrl m_scheduleCtrl;

	private CharacterSelectManager m_charSelMgr;

	private GameObject m_goMaidStatusListViewer;

	public class MaidStatusButton
	{
		public Maid maid;

		public string id;

		public string name;

		public string firstName;

		public string lastName;

		public int Rranking;

		public bool isReader;

		public Texture2D crownIcon;

		public Texture2D maidIcon;

		public UIButton uiButton;

		public UITexture uiMaidIcon;

		public string contractTypeName;

		public GameObject selectCursor;
	}
}