using System;
using UnityEngine;

public class SlotUImgr : MonoBehaviour
{
	public static SlotUImgr Instance { get; private set; }

	public bool uiActive
	{
		get
		{
			return this.m_SlotGameUI.interactable && !GameMain.Instance.SysDlg.isActiveAndEnabled;
		}
	}

	private void Awake()
	{
		SlotUImgr.Instance = this;
	}

	private void Start()
	{
		ExChangeUI instance = ExChangeUI.Instance;
		instance.FadeInStartAction = (Action)Delegate.Combine(instance.FadeInStartAction, new Action(delegate()
		{
			this.m_ButtonGroup.interactable = false;
		}));
		ExChangeUI instance2 = ExChangeUI.Instance;
		instance2.FadeOutEndAction = (Action)Delegate.Combine(instance2.FadeOutEndAction, new Action(this.UpdateUI));
		this.UpdateUI();
	}

	public void SetUIActive(bool set)
	{
		this.m_SlotGameUI.interactable = set;
	}

	public void UpdateUI()
	{
		int state = SceneCasinoSlot.Instance.sManager.state;
		this.m_SlotStopUI.interactable = (state >= 6 && state < 10);
		this.m_ButtonGroup.interactable = (state == 0 || state == 1);
		ExChangeUI.Instance.TextUIUpdate();
		ExChangeUI.Instance.SetButtonState(false);
		if (this.m_ButtonGroup.interactable)
		{
			ExChangeUI.Instance.UIStateUpdate();
			ExChangeUI.Instance.SetButtonState(true);
		}
	}

	public void PushEnd()
	{
		GameMain.Instance.SysDlg.Show("カジノ画面に戻ります", SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(SceneCasinoSlot.Instance.SlotEnd), null);
	}

	[SerializeField]
	private CanvasGroup m_SlotGameUI;

	[SerializeField]
	private CanvasGroup m_SlotStopUI;

	[SerializeField]
	private CanvasGroup m_ButtonGroup;
}
