using System;
using Cute;
using UnityEngine;
using Wizard;

public class ConventionListPlate : MonoBehaviour
{
	private const string DECK_ENTRY_SPRITE = "btn_decklogin";

	private const string GAME_START_SPRITE = "btn_competition";

	[SerializeField]
	private UIButton _button;

	[SerializeField]
	private UILabel _conventionName;

	[SerializeField]
	private UILabel _deckSetTimeLimit;

	private ConventionInfo _conventionInfo;

	public Action<ConventionInfo> OnSelect { get; set; }

	private void Start()
	{
		_button.onClick.Add(new EventDelegate(delegate
		{
			OnClickConvention();
		}));
	}

	public void Initialize(ConventionInfo convention)
	{
		_conventionInfo = convention;
		_conventionName.text = convention.Name;
		if (convention.Status == ConventionInfo.ConventionStatus.GameStart)
		{
			_deckSetTimeLimit.gameObject.SetActive(value: false);
			_button.normalSprite = "btn_competition";
			return;
		}
		_deckSetTimeLimit.gameObject.SetActive(value: true);
		_deckSetTimeLimit.text = Data.SystemText.Get("Arena_0126", convention.DeckEntryLimitText);
		_button.normalSprite = "btn_decklogin";
	}

	public void FadeOutHide()
	{
		FadeUtility.FadeOutObjectAndNonActive(_button.gameObject);
		_button.enabled = false;
	}

	private void OnClickConvention()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		OnSelect.Call(_conventionInfo);
	}
}
