using System;
using System.Collections;
using UnityEngine;

public class ResultIncomeAPI
{
	public void SceneStart(MonoBehaviour f_parent, ResultIncomeAPI.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.MainCamera.Reset(CameraMain.CameraType.Target, true);
		GameMain.Instance.MainCamera.Blur(true);
		GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
		if (DailyMgr.IsLegacy)
		{
			GameMain.Instance.SoundMgr.PlayBGMLegacy("BGM015.ogg", 1f, true);
		}
		else
		{
			GameMain.Instance.SoundMgr.PlayBGM("BGM015.ogg", 1f, 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.BgMgr.ChangeBg("ShinShitsumu_Night");
		GameMain.Instance.CharacterMgr.DeactivateCharaAll();
		f_parent.StartCoroutine(this.CoCharaLoad());
	}

	private IEnumerator CoCharaLoad()
	{
		while (GameMain.Instance.CharacterMgr.IsBusy())
		{
			yield return null;
		}
		GameMain.Instance.CharacterMgr.ResetCharaPosAll();
		GameMain.Instance.MainCamera.FadeIn(1f, false, null, true, true, default(Color));
		if (this.m_dgStart != null)
		{
			this.m_dgStart();
		}
		yield break;
	}

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

	private void OnFinishFadeOut()
	{
		GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
		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 ResultIncomeAPI.dgOnSceneStartCallBack m_dgStart;

	private ResultIncomeAPI.dgOnSceneFinalCallBack m_dgFinal;

	public delegate void dgOnSceneStartCallBack();

	public delegate void dgOnSceneFinalCallBack();
}
