using System;
using UnityEngine;
using wf;

public class YotogiOldFreeSkillSelectManager : WfScreenChildren
{
	public override void Awake()
	{
		base.Awake();
		this.yotogi_mgr_ = base.GetComponentInParent<YotogiOldManager>();
		this.load_asset_object = Utility.CreatePrefab(UTY.GetChildObject(base.root_obj, "FreeSkillSelectParent", false).gameObject, "SceneFreeModeSelect/Prefab/FreeSkillSelect", true);
		this.free_skill_select_ = this.load_asset_object.AddComponent<FreeSkillSelectOld>();
		this.free_skill_select_.SetYotogiManager(this.yotogi_mgr_);
		this.ok_btn_ = UTY.GetChildObject(base.root_obj, "CommonPanel/UnderButtonGroup/Next", false).GetComponent<UIButton>();
		this.ok_btn_.onClick.Add(new EventDelegate(this, "OnClickOK"));
		this.chancel_btn_ = UTY.GetChildObject(base.root_obj, "CommonPanel/UnderButtonGroup/Cancel", false).GetComponent<UIButton>();
		this.chancel_btn_.onClick.Add(new EventDelegate(this, "OnClickCancel"));
	}

	public void OnDestroy()
	{
		if (this.load_asset_object != null)
		{
			UnityEngine.Object.Destroy(this.load_asset_object);
		}
		this.load_asset_object = null;
	}

	protected override void OnCall()
	{
		if (this.load_asset_object.transform.parent != UTY.GetChildObject(base.root_obj, "FreeSkillSelectParent", false).transform)
		{
			this.load_asset_object.transform.SetParent(UTY.GetChildObject(base.root_obj, "FreeSkillSelectParent", false).transform, false);
		}
		this.ok_btn_.normalSprite = "cm3d2_common_okbuttom";
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		this.maid_ = this.yotogi_mgr_.maid;
		this.free_skill_select_.SetMaid(this.maid_);
		this.free_skill_select_.CreateInstanceButton();
		this.maid_.status.currentExcite = 0;
		this.yotogi_mgr_.is_free_mode = true;
		for (int i = 0; i < characterMgr.GetMaidCount(); i++)
		{
			Maid maid = characterMgr.GetMaid(i);
			if (!(maid == null))
			{
				maid.Visible = true;
				maid.AllProcPropSeqStart();
			}
		}
		characterMgr.GetMan(0).Visible = true;
		characterMgr.GetMan(0).AllProcPropSeqStart();
	}

	protected override bool IsCallFadeIn()
	{
		CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
		if (characterMgr.IsBusy())
		{
			return false;
		}
		Maid man = characterMgr.GetMan(0);
		for (int i = 0; i < characterMgr.GetMaidCount(); i++)
		{
			Maid maid = characterMgr.GetMaid(i);
			if (!(maid == null))
			{
				maid.SetPosOffset(Vector3.zero);
				if (1 <= i)
				{
					maid.Visible = false;
				}
			}
		}
		characterMgr.GetMan(0).Visible = false;
		this.free_skill_select_.FixSkill();
		return true;
	}

	private void OnClickOK()
	{
		if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
		{
			this.Finish();
		}
	}

	private void OnClickCancel()
	{
		if (string.IsNullOrEmpty(this.cancel_label))
		{
			return;
		}
		this.yotogi_mgr_.null_mgr.SetNextLabel(this.cancel_label);
		this.Finish();
	}

	protected override void OnFadeEnd()
	{
		this.free_skill_select_.FixSkill();
		GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
		if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
		{
			this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.Null.ToString());
		}
	}

	public GameObject skill_select_prefab_object
	{
		get
		{
			return this.load_asset_object;
		}
	}

	public string cancel_label
	{
		get
		{
			return this.cancel_label_;
		}
		set
		{
			this.cancel_label_ = value;
		}
	}

	private Maid maid_;

	private YotogiOldManager yotogi_mgr_;

	private FreeSkillSelectOld free_skill_select_;

	private UIButton ok_btn_;

	private UIButton chancel_btn_;

	private GameObject load_asset_object;

	private string cancel_label_ = string.Empty;
}
