using System;
using Cute;
using UnityEngine;

namespace Wizard;

public class ChatSendReplayListUI
{
	private const int DEPTH_REPLAY_SHARE_CONFIRM_DIALOG = 15;

	private ChatReplayListDialog _prefabReplayShareDialog;

	private ChatReplaySendConfirmDialog _prefabReplaySendConfirmDialog;

	private Action<ReplayInfoItem> _onDecideReplay;

	private DialogBase _dialogReplayList;

	public ChatSendReplayListUI(ChatReplayListDialog prefabReplayShareDialog, ChatReplaySendConfirmDialog prefabReplaySendConfirmDialog, Action<ReplayInfoItem> onDecideDeck)
	{
		_prefabReplayShareDialog = prefabReplayShareDialog;
		_prefabReplaySendConfirmDialog = prefabReplaySendConfirmDialog;
		_onDecideReplay = onDecideDeck;
	}

	public void CreateReplayListDialog()
	{
		_dialogReplayList = UIManager.GetInstance().CreateDialogClose();
		_dialogReplayList.SetSize(DialogBase.Size.XL);
		_dialogReplayList.SetTitleLabel(Data.SystemText.Get("OtherTop_0033"));
		_dialogReplayList.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
		ChatReplayListDialog chatReplayListDialog = UnityEngine.Object.Instantiate(_prefabReplayShareDialog);
		_dialogReplayList.SetObj(chatReplayListDialog.gameObject);
		chatReplayListDialog.Init(Data.ReplayInfo.Items, CreateReplaySelectConfirmDialog);
	}

	private void CreateReplaySelectConfirmDialog(ReplayInfoItem infoItem)
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
		dialogBase.SetTitleLabel(Data.SystemText.Get("Guild_Chat_0003"));
		dialogBase.SetButtonText(Data.SystemText.Get("Guild_Chat_0026"));
		dialogBase.SetPanelDepth(15);
		ChatReplaySendConfirmDialog chatReplaySendConfirmDialog = UnityEngine.Object.Instantiate(_prefabReplaySendConfirmDialog);
		dialogBase.SetObj(chatReplaySendConfirmDialog.gameObject);
		chatReplaySendConfirmDialog.SetData(PlayerStaticData.UserName, PlayerStaticData.UserEmblemID, infoItem);
		dialogBase.onPushButton1 = delegate
		{
			_onDecideReplay.Call(infoItem);
			_dialogReplayList.Close();
		};
	}
}
