using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using com.workman.cm3d2.scene.dailyEtc;
using I2.Loc;
using MaidStatus;
using PlayerStatus;
using Schedule;
using UnityEngine;

public class CharacterSelectMain : WfScreenChildren
{
	public static bool compatibilityMode
	{
		get
		{
			return DailyMgr.IsLegacy;
		}
	}

	public override void Awake()
	{
		base.Awake();
		this.explanatory_label_ = UTY.GetChildObject(base.root_obj, "ExplanatoryText/Value", false).GetComponent<UILabel>();
		GameObject childObject = UTY.GetChildObject(base.root_obj, "ButtonParent/Tower/Grid", false);
		this.button_dic_.Add("全選択", UTY.GetChildObject(childObject, "全選択", false).GetComponent<UIButton>());
		EventDelegate.Add(this.button_dic_["全選択"].onClick, new EventDelegate.Callback(this.OnSelectAllChara));
		this.button_dic_.Add("全解除", UTY.GetChildObject(childObject, "全解除", false).GetComponent<UIButton>());
		EventDelegate.Add(this.button_dic_["全解除"].onClick, new EventDelegate.Callback(this.OnSelectAllReleaseChara));
		this.button_dic_.Add("OK", UTY.GetChildObject(base.root_obj, "ButtonParent/OK", false).GetComponent<UIButton>());
		this.button_dic_.Add("Cancel", UTY.GetChildObject(base.root_obj, "ButtonParent/Cancel", false).GetComponent<UIButton>());
		this.button_dic_["Cancel"].gameObject.SetActive(false);
		foreach (KeyValuePair<string, UIButton> keyValuePair in this.button_dic_)
		{
			EventDelegate.Add(keyValuePair.Value.onClick, new EventDelegate.Callback(this.OnClickButton));
		}
		this.chara_select_mgr_ = UTY.GetChildObject(base.root_obj, "CharacterSelectPanel", false).GetComponent<CharacterSelectManager>();
	}

	protected override void OnCall()
	{
		this.auto_select_ = false;
		this.wait_count_ = 0;
		this.loaded_check_maid_.Clear();
		this.select_maid_ = null;
		this.chara_mgr_ = GameMain.Instance.CharacterMgr;
		this.scene_chara_select_ = (base.parent_mgr as SceneCharacterSelect);
		NDebug.AssertNull(this.scene_chara_select_);
		this.button_dic_["全選択"].gameObject.SetActive(false);
		this.button_dic_["全解除"].gameObject.SetActive(false);
		if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Additional)
		{
			this.OnCallAdditionalType();
			return;
		}
		for (int i = 0; i < this.chara_mgr_.GetMaidCount(); i++)
		{
			if (this.chara_mgr_.GetMaid(i) != null)
			{
				this.chara_mgr_.Deactivate(i, false);
			}
		}
		if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Communication)
		{
			NDebug.Assert("コミュキャラ選択は廃止されました", false);
			GameMain.Instance.BgMgr.ChangeBg("Syosai");
			GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(-2.526511f, 1.715126f, -2.023701f), 7.999995f, new Vector2(-128.2036f, -6.149067f));
			this.chara_select_mgr_.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
			{
				List<Maid> list3 = ScheduleAPI.CanCommunicationMaids(true);
				for (int m = 0; m < list3.Count; m++)
				{
					draw_maid_list.Add(list3[m]);
				}
			});
			this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
			if (this.chara_select_mgr_.maid_list_count == 1)
			{
				this.auto_select_ = true;
			}
			if (!this.auto_select_)
			{
				GameMain.Instance.SoundMgr.PlayBGM("BGM015.ogg", 0.5f, true);
			}
			this.SetExplanatoryLabel("コミュニケーションを行うメイドを選択してください。");
		}
		else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Yotogi || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Vip || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Facility)
		{
			if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Yotogi || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Vip)
			{
				if (!CharacterSelectMain.compatibilityMode)
				{
					GameMain.Instance.BgMgr.ChangeBg("Theater");
					GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(12.39468f, 5.495444f, 22.72065f), 0.1f, new Vector2(-6.047941f, 14.65832f));
				}
				else
				{
					GameMain.Instance.BgMgr.ChangeBg("Salon");
					GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(1.485176f, 0.5354422f, 1.606312f), 13.60001f, new Vector2(-208.1436f, -0.869565f));
				}
			}
			else
			{
				GameMain.Instance.BgMgr.ChangeBg("EmpireClub_Rotary");
				GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(6.673284f, 3.031431f, 20.00305f), 0.2f, new Vector2(562.5145f, -4.906824f));
			}
			this.chara_select_mgr_.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
			{
				List<string> chara_guid_stock_list = SceneCharacterSelect.chara_guid_stock_list;
				for (int m = 0; m < chara_guid_stock_list.Count; m++)
				{
					Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(chara_guid_stock_list[m]);
					if (stockMaid2 != null)
					{
						if (!CharacterSelectMain.compatibilityMode)
						{
							draw_maid_list.Add(stockMaid2);
						}
						else if (stockMaid2.status.isCompatiblePersonality)
						{
							draw_maid_list.Add(stockMaid2);
						}
					}
				}
			});
			this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
			if (this.chara_select_mgr_.maid_list_count == 1 && this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Vip)
			{
				this.auto_select_ = true;
			}
			if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Yotogi)
			{
				this.SetExplanatoryLabel("夜伽を行うメイドを選択してください。");
			}
			else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Vip)
			{
				this.SetExplanatoryLabel("Hイベントを行うメイドを選択してください。");
			}
			else
			{
				this.SetExplanatoryLabel("施設強化を行うメイドを選択してください。");
			}
			if (!this.auto_select_)
			{
				if (!CharacterSelectMain.compatibilityMode)
				{
					GameMain.Instance.SoundMgr.PlayBGM("BGM015.ogg", 0.5f, true);
				}
				else
				{
					GameMain.Instance.SoundMgr.PlayBGMLegacy("BGM014.ogg", 0.5f, true);
				}
			}
		}
		else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.CompetitiveShow)
		{
			if (!CharacterSelectMain.compatibilityMode)
			{
				GameMain.Instance.BgMgr.ChangeBg("Theater");
				GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(6.502444f, 1.154878f, 27.09383f), 0.1f, new Vector2(200.2396f, -12.36027f));
			}
			else
			{
				GameMain.Instance.BgMgr.ChangeBg("Salon_Day");
				GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(1.485176f, 0.5354422f, 1.606312f), 13.60001f, new Vector2(-208.1436f, -0.869565f));
			}
			this.chara_select_mgr_.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
			{
				List<Maid> list3 = new List<Maid>();
				CharacterSelectManager.DefaultMaidList(list3);
				for (int m = 0; m < list3.Count; m++)
				{
					if (!CharacterSelectMain.compatibilityMode && (list3[m].status.heroineType == HeroineType.Original || list3[m].status.heroineType == HeroineType.Transfer))
					{
						draw_maid_list.Add(list3[m]);
					}
					else if (CharacterSelectMain.compatibilityMode && list3[m].status.isCompatiblePersonality)
					{
						draw_maid_list.Add(list3[m]);
					}
				}
			});
			this.chara_select_mgr_.SetCallBackOnMultiSelect(new CharacterSelectManager.CallBackOnMultiSelect(this.OnMultiSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Multiple, this.chara_mgr_.GetStockMaidCount(), false);
			this.button_dic_["OK"].isEnabled = false;
			if (this.chara_select_mgr_.maid_list_count == 1)
			{
				Maid[] array = new Maid[1];
				List<Maid> list = new List<Maid>();
				List<Maid> list2 = new List<Maid>();
				CharacterSelectManager.DefaultMaidList(list2);
				for (int j = 0; j < list2.Count; j++)
				{
					if (!CharacterSelectMain.compatibilityMode && list2[j].status.heroineType == HeroineType.Original)
					{
						list.Add(list2[j]);
					}
					else if (CharacterSelectMain.compatibilityMode && list2[j].status.isCompatiblePersonality)
					{
						list.Add(list2[j]);
					}
				}
				if (0 < list.Count)
				{
					array[0] = list[0];
				}
				if (array[0] != null)
				{
					this.OnMultiSelectChara(array);
					this.auto_select_ = true;
				}
			}
			if (!this.auto_select_)
			{
				if (!CharacterSelectMain.compatibilityMode)
				{
					GameMain.Instance.SoundMgr.PlayBGM("BGM006.ogg", 0.5f, true);
				}
				else
				{
					GameMain.Instance.SoundMgr.PlayBGMLegacy("BGM021.ogg", 0.5f, true);
				}
			}
			this.button_dic_["全選択"].gameObject.SetActive(true);
			this.button_dic_["全解除"].gameObject.SetActive(true);
			this.button_dic_["全選択"].isEnabled = true;
			this.button_dic_["全解除"].isEnabled = false;
			this.SetExplanatoryLabel("品評会を行うメイドを選択してください。");
		}
		else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Free)
		{
			if (!CharacterSelectMain.compatibilityMode)
			{
				GameMain.Instance.BgMgr.ChangeBg("Theater");
				GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(12.39468f, 5.495444f, 22.72065f), 0.1f, new Vector2(-6.047941f, 14.65832f));
			}
			else
			{
				GameMain.Instance.BgMgr.ChangeBg("Syosai");
			}
			this.chara_select_mgr_.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
			{
				List<Maid> list3 = new List<Maid>();
				CharacterSelectManager.DefaultMaidList(list3);
				for (int m = 0; m < list3.Count; m++)
				{
					if (!CharacterSelectMain.compatibilityMode)
					{
						draw_maid_list.Add(list3[m]);
					}
					else if (list3[m].status.isCompatiblePersonality)
					{
						draw_maid_list.Add(list3[m]);
					}
				}
			});
			this.SetExplanatoryLabel("メイドを選択してください。");
			this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
			if (this.chara_select_mgr_.maid_list_count == 1)
			{
				this.auto_select_ = true;
			}
		}
		else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.TouchCharaSelect)
		{
			if (GameMain.Instance.CharacterMgr.status.isDaytime)
			{
				GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg);
			}
			else
			{
				GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg);
			}
			GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(1.32781f, 1.400725f, -0.06648348f), 0.1f, new Vector2(214.6109f, 8.136656f));
			this.chara_select_mgr_.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
			{
				List<Maid> list3 = new List<Maid>();
				CharacterSelectManager.DefaultMaidList(list3);
				for (int m = 0; m < list3.Count; m++)
				{
					if (!CharacterSelectMain.compatibilityMode)
					{
						draw_maid_list.Add(list3[m]);
					}
					else if (list3[m].status.isCompatiblePersonality)
					{
						draw_maid_list.Add(list3[m]);
					}
				}
			});
			this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
			if (this.chara_select_mgr_.maid_list_count == 1)
			{
				this.auto_select_ = true;
			}
			if (!this.auto_select_)
			{
				GameMain.Instance.SoundMgr.PlayBGM("BGM015.ogg", 0.5f, true);
			}
			this.SetExplanatoryLabel("おさわりを行うメイドを選択してください。");
		}
		else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.VRComSelect)
		{
			this.chara_select_mgr_.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
			{
				List<Maid> list3 = new List<Maid>();
				CharacterSelectManager.DefaultMaidList(list3);
				for (int m = 0; m < list3.Count; m++)
				{
					if (!CharacterSelectMain.compatibilityMode)
					{
						draw_maid_list.Add(list3[m]);
					}
					else if (list3[m].status.isCompatiblePersonality)
					{
						draw_maid_list.Add(list3[m]);
					}
				}
			});
			this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
			if (this.chara_select_mgr_.maid_list_count == 1)
			{
				this.auto_select_ = true;
			}
			this.SetExplanatoryLabel("バカンスに連れていくメイドを選択してください。");
		}
		else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.VRKaraokeSelect)
		{
			CharacterSelectManager characterSelectManager = this.chara_select_mgr_;
			if (CharacterSelectMain.<>f__mg$cache0 == null)
			{
				CharacterSelectMain.<>f__mg$cache0 = new CharacterSelectManager.CallBackMaidList(KaraokeDataManager.GetMaidListKaraoke);
			}
			characterSelectManager.SetCallBackMaidList(CharacterSelectMain.<>f__mg$cache0);
			this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
			if (this.chara_select_mgr_.maid_list_count == 1)
			{
				this.auto_select_ = true;
			}
			this.SetExplanatoryLabel("カラオケに連れていくメイドを選択してください。");
		}
		else if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Recollection)
		{
			if (!CharacterSelectMain.compatibilityMode)
			{
				GameMain.Instance.BgMgr.ChangeBg("ShinShitsumu_ChairRot");
				GameMain.Instance.MainCamera.SetFromScriptOnTarget(new Vector3(-0.4103856f, 1.075485f, 0.775088f), 1.6f, new Vector2(321.3178f, 3.478252f));
			}
			else
			{
				GameMain.Instance.BgMgr.ChangeBg("Syosai");
			}
			string text = "recollection_subheroine.nei";
			List<int> subMaidList = new List<int>();
			using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
			{
				using (CsvParser csvParser = new CsvParser())
				{
					bool condition = csvParser.Open(afileBase);
					NDebug.Assert(condition, text + "\nopen failed.");
					for (int k = 1; k < csvParser.max_cell_y; k++)
					{
						if (csvParser.IsCellToExistData(0, k))
						{
							int cellAsInteger = csvParser.GetCellAsInteger(0, k);
							int cellAsInteger2 = csvParser.GetCellAsInteger(2, k);
							subMaidList.Add(cellAsInteger2);
						}
					}
				}
			}
			this.chara_select_mgr_.SetCallBackMaidList(delegate(List<Maid> draw_maid_list)
			{
				List<Maid> list3 = new List<Maid>();
				CharacterSelectManager.DefaultMaidList(list3);
				for (int m = 0; m < list3.Count; m++)
				{
					Maid maid = list3[m];
					if (maid.status.subCharaData == null || subMaidList.Contains(maid.status.subCharaData.id))
					{
						if (!CharacterSelectMain.compatibilityMode || maid.status.isCompatiblePersonality)
						{
							draw_maid_list.Add(list3[m]);
						}
					}
				}
			});
			this.SetExplanatoryLabel("メイドを選択してください。");
			this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
			this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
			if (this.chara_select_mgr_.maid_list_count == 1)
			{
				this.auto_select_ = true;
			}
		}
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		for (int l = 0; l < characterMgr.GetStockMaidCount(); l++)
		{
			Maid stockMaid = characterMgr.GetStockMaid(l);
			if (stockMaid != null)
			{
				stockMaid.FaceAnime("通常", 0f, 0);
				stockMaid.FaceBlend("無し");
			}
		}
		GameMain.Instance.CharacterMgr.DeactivateCharaAll();
	}

	private void OnCallAdditionalType()
	{
		Debug.Log("メイドをアクティブ化させるスロット : " + this.scene_chara_select_.select_maid_slot);
		CharacterSelectManager characterSelectManager = this.chara_select_mgr_;
		if (CharacterSelectMain.<>f__mg$cache1 == null)
		{
			CharacterSelectMain.<>f__mg$cache1 = new CharacterSelectManager.CallBackMaidList(KaraokeDataManager.GetMaidListAdditional);
		}
		characterSelectManager.SetCallBackMaidList(CharacterSelectMain.<>f__mg$cache1);
		this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara));
		this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true);
		if (this.chara_select_mgr_.maid_list_count == 1)
		{
			this.auto_select_ = true;
		}
		this.SetExplanatoryLabel("*メイドの追加呼び出し*");
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
		{
			Maid stockMaid = characterMgr.GetStockMaid(i);
			if (stockMaid != null)
			{
				stockMaid.FaceAnime("通常", 0f, 0);
				stockMaid.FaceBlend("無し");
			}
		}
	}

	protected override bool IsCallFadeIn()
	{
		if (this.auto_select_)
		{
			base.SetFadeStatus(WfScreenChildren.FadeStatus.Wait);
			float fade_time = base.fade_time;
			base.SetFadeTime(0f);
			this.Finish();
			base.SetFadeTime(fade_time);
			return false;
		}
		this.wait_count_++;
		return 2 < this.wait_count_;
	}

	public void SetExplanatoryLabel(string text)
	{
		this.explanatory_label_.text = text;
		Localize component = this.explanatory_label_.gameObject.GetComponent<Localize>();
		component.SetTerm("SceneCharaSelect/" + text);
	}

	public void SetCancelLabel(string cancel_call_label)
	{
		this.cancel_call_label_ = cancel_call_label;
		this.button_dic_["Cancel"].gameObject.SetActive(!string.IsNullOrEmpty(this.cancel_call_label_));
	}

	private void OnSelectAllChara()
	{
		this.chara_select_mgr_.SelectAllMaid();
	}

	private void OnSelectAllReleaseChara()
	{
		this.chara_select_mgr_.SelectAllReleaseMaid();
	}

	private void OnSelectChara(Maid select_maid)
	{
		this.select_maid_ = select_maid;
	}

	private void OnSingleDanceSelectChara(Maid select_maid)
	{
		this.loaded_check_maid_.Clear();
		this.loaded_check_maid_.Add(select_maid);
	}

	private void OnMultiDanceSelectChara(Maid[] maid_array)
	{
		this.loaded_check_maid_.Clear();
		for (int i = 0; i < maid_array.Length; i++)
		{
			this.loaded_check_maid_.Add(maid_array[i]);
		}
	}

	private void OnMultiSelectChara(Maid[] maid_array)
	{
		this.loaded_check_maid_.Clear();
		bool isEnabled = false;
		bool flag = true;
		bool flag2 = true;
		for (int i = 0; i < maid_array.Length; i++)
		{
			if (maid_array[i] == null)
			{
				flag = false;
			}
			else
			{
				flag2 = false;
				isEnabled = true;
				this.loaded_check_maid_.Add(maid_array[i]);
			}
		}
		this.button_dic_["OK"].isEnabled = isEnabled;
		this.button_dic_["全選択"].isEnabled = !flag;
		this.button_dic_["全解除"].isEnabled = !flag2;
	}

	private void OnClickButton()
	{
		string text = string.Empty;
		foreach (KeyValuePair<string, UIButton> keyValuePair in this.button_dic_)
		{
			if (keyValuePair.Value == UIButton.current)
			{
				text = keyValuePair.Key;
				break;
			}
		}
		if (string.IsNullOrEmpty(text))
		{
			return;
		}
		if (text == "OK")
		{
			this.Finish();
		}
		else if (text == "Cancel")
		{
			if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Yotogi)
			{
				string f_strMsg = "まだ夜伽を実行していないメイドがいます。\n夜伽を終了しますか？";
				GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK_CANCEL, delegate
				{
					GameMain.Instance.SysDlg.Close();
					this.select_maid_ = null;
					this.scene_chara_select_.move_screen.SetNextLabel(this.cancel_call_label_);
					this.Finish();
				}, null);
			}
			else
			{
				this.select_maid_ = null;
				this.scene_chara_select_.move_screen.SetNextLabel(this.cancel_call_label_);
				this.Finish();
			}
		}
	}

	private void OnOvrCamFree()
	{
		GameMain.Instance.CMSystem.SetTmpGenericFlag("ダンスOVRカメラタイプ", 0);
		this.Finish();
	}

	private void OnOvrCamMove()
	{
		GameMain.Instance.CMSystem.SetTmpGenericFlag("ダンスOVRカメラタイプ", 1);
		this.Finish();
	}

	public override bool Finish()
	{
		bool flag = base.Finish();
		if (flag && 0 < this.loaded_check_maid_.Count)
		{
			GameMain.Instance.SoundMgr.StopBGM(1.5f);
		}
		return flag;
	}

	protected override void OnFinish()
	{
		this.button_dic_["Cancel"].gameObject.SetActive(false);
		if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Communication && this.select_maid_ != null)
		{
			int noonWorkId = this.select_maid_.status.noonWorkId;
			this.loaded_check_maid_.Add(this.select_maid_);
			ScheduleData[] scheduleSlot = GameMain.Instance.CharacterMgr.status.scheduleSlot;
			for (int i = 0; i < scheduleSlot.Length; i++)
			{
				if (scheduleSlot[i].maid_guid == this.select_maid_.status.guid)
				{
					scheduleSlot[i].noon_communication = true;
					break;
				}
			}
			if (noonWorkId == ScheduleAPI.GetNoonTrainerWorkId())
			{
				Maid noonTraineeMaid = ScheduleAPI.GetNoonTraineeMaid();
				NDebug.Assert(noonTraineeMaid != null, "研修生を特定できませんでした");
				this.loaded_check_maid_.Add(noonTraineeMaid);
			}
			else if (noonWorkId == ScheduleAPI.GetTraineeWorkId())
			{
				Maid noonTrainerMaid = ScheduleAPI.GetNoonTrainerMaid();
				NDebug.Assert(noonTrainerMaid != null, "研修官を特定できませんでした");
				this.loaded_check_maid_.Add(noonTrainerMaid);
			}
		}
		if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Yotogi || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Vip || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Facility || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Free || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Recollection)
		{
			if (this.select_maid_ != null)
			{
				this.loaded_check_maid_.Add(this.select_maid_);
				SceneCharacterSelect.chara_guid_stock_list.Remove(this.select_maid_.status.guid);
			}
			else
			{
				SceneCharacterSelect.chara_guid_stock_list.Clear();
			}
		}
		if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.CompetitiveShow)
		{
			CompetitiveShowMgr.check_maid_list.Clear();
			SceneCharacterSelect.select_maid_list.Clear();
			for (int j = 0; j < this.loaded_check_maid_.Count; j++)
			{
				SceneCharacterSelect.select_maid_list.Add(this.loaded_check_maid_[j]);
			}
			this.loaded_check_maid_.Clear();
		}
		if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.TouchCharaSelect && this.select_maid_ != null)
		{
			this.loaded_check_maid_.Add(this.select_maid_);
		}
		if ((this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.VRComSelect || this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.VRKaraokeSelect) && this.select_maid_ != null)
		{
			this.loaded_check_maid_.Add(this.select_maid_);
		}
		if (this.scene_chara_select_.select_type == SceneCharacterSelect.SelectType.Additional)
		{
			this.chara_mgr_.SetActiveMaid(this.select_maid_, this.scene_chara_select_.select_maid_slot);
		}
		for (int k = 0; k < this.loaded_check_maid_.Count; k++)
		{
			this.chara_mgr_.SetActiveMaid(this.loaded_check_maid_[k], k);
			this.loaded_check_maid_[k].Visible = true;
			this.loaded_check_maid_[k].AllProcPropSeqStart();
		}
		GameMain.Instance.LoadIcon.NextLoadIcontImmediatelyDisplay();
		if (this.loaded_check_maid_.Count == 0)
		{
			base.parent_mgr.CallScreen("Move");
		}
	}

	protected override void OnFadeEnd()
	{
		if (this.loaded_check_maid_.Count == 0)
		{
			return;
		}
		bool flag = true;
		for (int i = 0; i < this.loaded_check_maid_.Count; i++)
		{
			if (this.loaded_check_maid_[i].IsBusy)
			{
				flag = false;
				break;
			}
		}
		if (flag)
		{
			base.parent_mgr.CallScreen("Move");
			this.loaded_check_maid_.Clear();
		}
	}

	private SceneCharacterSelect scene_chara_select_;

	private Maid select_maid_;

	private CharacterMgr chara_mgr_;

	private CharacterSelectManager chara_select_mgr_;

	private Dictionary<string, UIButton> button_dic_ = new Dictionary<string, UIButton>();

	private List<Maid> loaded_check_maid_ = new List<Maid>();

	private UILabel explanatory_label_;

	private string cancel_call_label_ = string.Empty;

	private int wait_count_;

	private bool auto_select_;

	private FFNameDialog ovr_dance_cam_dlg_;

	[CompilerGenerated]
	private static CharacterSelectManager.CallBackMaidList <>f__mg$cache0;

	[CompilerGenerated]
	private static CharacterSelectManager.CallBackMaidList <>f__mg$cache1;
}
