using System;
using System.Collections;
using UnityEngine;

public class CompetitiveShowAPI
{
	public void SceneStart(MonoBehaviour f_parent, Maid visible_maid, CompetitiveShowAPI.dgOnSceneStartCallBack f_dgLoadedFinish)
	{
		this.m_dgStart = f_dgLoadedFinish;
		GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
		GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel();
		GameMain.Instance.MainLight.Reset();
		GameMain.Instance.MainLight.SetRotation(new Vector3(28.99218f, 178.2424f, 16.81662f));
		GameMain.Instance.MainLight.SetIntensity(0.95f);
		GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
		GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.08306749f, 1.299064f, 0.0249091f), true);
		GameMain.Instance.MainCamera.SetDistance(2.2f, true);
		GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(177.9044f, 2.546583f), true);
		GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
		GameMain.Instance.SoundMgr.VoiceStopAll();
		if (CompetitiveShowMgr.compatibilityMode)
		{
			GameMain.Instance.BgMgr.ChangeBg("Salon");
		}
		else
		{
			GameMain.Instance.BgMgr.ChangeBg("Theater");
		}
		GameMain.Instance.CharacterMgr.DeactivateCharaAll();
		if (visible_maid == null)
		{
			visible_maid = GameMain.Instance.CharacterMgr.GetStockMaid(0);
		}
		GameMain.Instance.CharacterMgr.SetActiveMaid(visible_maid, 0);
		visible_maid.Visible = true;
		f_parent.StartCoroutine(this.CoCharaLoad());
	}

	private IEnumerator CoCharaLoad()
	{
		while (GameMain.Instance.CharacterMgr.IsBusy())
		{
			yield return null;
		}
		GameMain.Instance.CharacterMgr.ResetCharaPosAll();
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		ScriptManager script_mgr = GameMain.Instance.ScriptMgr;
		script_mgr.is_motion_blend = false;
		script_mgr.LoadMotionScript(0, false, "h_kaiwa_tati_001.ks", "*会話立ち待機", string.Empty, string.Empty, false, true);
		script_mgr.is_motion_blend = true;
		maid.FaceAnime("通常", 1f, 0);
		maid.FaceBlend("無し");
		maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
		GameMain.Instance.MainCamera.FadeIn(1f, false, null, true, true, default(Color));
		if (this.m_dgStart != null)
		{
			this.m_dgStart();
		}
		yield break;
	}

	public void EndNextScene(CompetitiveShowAPI.dgOnSceneFinalCallBack f_dgEnd)
	{
		this.m_dgFinal = f_dgEnd;
		GameMain.Instance.MainCamera.FadeOut(1f, false, new CameraMain.dgOnCompleteFade(this.OnFinishFadeOut), true, default(Color));
	}

	private void OnFinishFadeOut()
	{
		if (this.m_dgFinal != null)
		{
			this.m_dgFinal();
		}
	}

	public void SceneFinish()
	{
		if (GameMain.Instance.MainCamera != null)
		{
			GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
		}
		if (GameMain.Instance.CharacterMgr != null)
		{
			GameMain.Instance.CharacterMgr.DeactivateCharaAll();
		}
	}

	private CompetitiveShowAPI.dgOnSceneStartCallBack m_dgStart;

	private CompetitiveShowAPI.dgOnSceneFinalCallBack m_dgFinal;

	public delegate void dgOnSceneStartCallBack();

	public delegate void dgOnSceneFinalCallBack();
}
