using UnityEngine;
using Wizard;

public class TitleMenu : MonoBehaviour
{
	[SerializeField]
	protected UIButton BtnCacheClear;

	[SerializeField]
	protected UIButton BtnNewInfo;

	[SerializeField]
	protected UIButton BtnCs;

	[SerializeField]
	protected UIButton _quitBtn;

	[SerializeField]
	protected UIButton _deleteUserDataButton;

	public GameObject ParentObject;

	private DialogBase dia;

	private void Start()
	{
		EventDelegate.Add(BtnCacheClear.onClick, ShowCacheClearInfo);
		EventDelegate.Add(BtnNewInfo.onClick, ShowWebViewInfo);
		EventDelegate.Add(BtnCs.onClick, ShowFAQInfo);
		_quitBtn.gameObject.SetActive(value: true);
		EventDelegate.Add(_quitBtn.onClick, Application.Quit);
		_deleteUserDataButton.gameObject.SetActive(value: false);
	}

	public void ShowWebViewInfo()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.INFO);
	}

	private void ShowFAQInfo()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		DialogSupport.Create();
	}

	private void ShowCacheClearInfo()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		SystemText systemText = Data.SystemText;
		dia = UIManager.GetInstance().CreateDialogClose();
		dia.SetSize(DialogBase.Size.M);
		dia.SetTitleLabel(systemText.Get("Title_0007"));
		dia.SetText(systemText.Get("Title_0008"));
		dia.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
		dia.SetButtonText(systemText.Get("Dia_Title_001_Button"));
		dia.SetReturnMsg(ParentObject, "ClearCache");
		dia.SetPanelDepth(3000);
	}

	private void OnClickDeleteUserDataButton()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetSize(DialogBase.Size.M);
		dialogBase.SetTitleLabel(Data.SystemText.Get("Title_0046"));
		dialogBase.SetText(Data.SystemText.Get("Title_0047"));
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn);
		dialogBase.SetButtonText(Data.SystemText.Get("Title_0048"));
		dialogBase.onPushButton1 = OpenDeleteUserDataConfirmDialog;
		dialogBase.SetPanelDepth(3000);
	}

	private void OpenDeleteUserDataConfirmDialog()
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetSize(DialogBase.Size.M);
		dialogBase.SetTitleLabel(Data.SystemText.Get("Title_0051"));
		dialogBase.SetText(Data.SystemText.Get("Title_0049"));
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn);
		dialogBase.SetButtonText(Data.SystemText.Get("Title_0048"));
		dialogBase.SetReturnMsg(ParentObject, "DeleteUserData");
		dialogBase.SetPanelDepth(3000);
	}
}
