using System;
using UnityEngine;

public class StartDailyMgr : BaseCreatePanel
{
	public override void Init()
	{
		this.m_goPanel = base.GetPanel("StartDailyPanel");
		this.m_ctrl = base.GetCtrl<StartDailyCtrl>();
		this.m_ctrl.Init(this, this.m_goPanel);
		this.m_api = new StartDailyAPI();
		this.m_goPanel.SetActive(false);
		this.ExecuteRelatedAPI();
	}

	private void ExecuteRelatedAPI()
	{
	}

	public void OpenStartDailyPanel()
	{
		this.m_enableClick = (this.m_Click = false);
		if (GameMain.Instance.IsForceSkip())
		{
			base.SetDurationToFadeIn(0.001f);
		}
		this.m_api.SceneStart(this, new StartDailyAPI.dgOnSceneStartCallBack(this.OpenStartDailyCallBack));
	}

	public void OpenStartDailyCallBack()
	{
		base.BaseOpenPanel();
	}

	protected override void OpenPanel()
	{
		int data = this.LoadGamePlayDays();
		this.m_ctrl.CreateViewer(data);
	}

	private int LoadGamePlayDays()
	{
		return GameMain.Instance.CharacterMgr.status.days + 1;
	}

	protected override void AfterOpen()
	{
		this.m_enableClick = true;
	}

	public void CloseStartDailyPanel()
	{
		base.BaseClosePanel();
	}

	protected override void AfterClose()
	{
		if (this.sceneMgr != null)
		{
			this.m_api.EndNextScene(new StartDailyAPI.dgOnSceneFinalCallBack(this.sceneMgr.CloseScene));
		}
	}

	protected override void SetFadeTargetPanel()
	{
		this.fadeTargetPanel = this.m_goPanel;
	}

	private void Update()
	{
		if (((Input.anyKey && !NInput.GetMouseButton(1) && !NInput.GetMouseButton(2)) || NInput.GetMouseButtonUp(0)) && (this.m_enableClick || (this.m_goPanel != null && this.m_goPanel.GetComponent<UIPanel>().alpha == 1f)) && !UICamera.isOverUI)
		{
			if (GameMain.Instance.IsForceSkip())
			{
				base.SetDurationToFadeOut(0.001f);
			}
			if (!this.m_Click)
			{
				this.CloseStartDailyPanel();
			}
			this.m_Click = true;
		}
	}

	[SerializeField]
	private int dummyDays;

	private StartDailyCtrl m_ctrl;

	private StartDailyAPI m_api;

	private bool m_enableClick;

	private bool m_Click;
}
