using System;
using Cute;
using UnityEngine;

namespace Wizard;

public class ChatReplayListDialogContent : MonoBehaviour
{
	[SerializeField]
	private ReplayContentView _prefabReplayInfoView;

	[SerializeField]
	private GameObject _rootReplayInfoView;

	[SerializeField]
	private UIButton _btnReplaySend;

	private ReplayContentView _replayInfoView;

	public void SetData(ReplayInfoItem replayInfoItem, Action onClickReplaySend)
	{
		if (_replayInfoView == null)
		{
			_replayInfoView = NGUITools.AddChild(_rootReplayInfoView, _prefabReplayInfoView.gameObject).GetComponent<ReplayContentView>();
		}
		_replayInfoView.SetData(replayInfoItem);
		_btnReplaySend.onClick.Clear();
		_btnReplaySend.onClick.Add(new EventDelegate(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			onClickReplaySend.Call();
		}));
	}
}
