using UnityEngine;

namespace Wizard;

public class PremiumCardConversionDialogParts : MonoBehaviour
{
	[SerializeField]
	private UILabel _text2;

	[SerializeField]
	private UILabel _textWarning;

	[SerializeField]
	private UILabel _beforeOrbNum;

	[SerializeField]
	private UILabel _afterOrbNum;

	public void Initialize(CardParameter cardData)
	{
		SystemText systemText = Data.SystemText;
		_text2.text = systemText.Get("Card_0162_3", cardData.CardName);
		_beforeOrbNum.text = PlayerStaticData.UserOrbNum.ToString();
		_afterOrbNum.text = systemText.Get("Card_0162_6", (PlayerStaticData.UserOrbNum - 1).ToString());
		SetWarningText(cardData);
	}

	private void SetWarningText(CardParameter cardData)
	{
		if (cardData.IsPreReleaseCard)
		{
			_textWarning.gameObject.SetActive(value: false);
			return;
		}
		SystemText systemText = Data.SystemText;
		if (cardData.IsResurgentCard)
		{
			_textWarning.gameObject.SetActive(value: true);
			_textWarning.text = systemText.Get("Card_0300");
		}
		else if (!cardData.IsAvailableFormat(Format.Unlimited, ClassType.None))
		{
			_textWarning.gameObject.SetActive(value: true);
			_textWarning.text = systemText.Get("Card_0204");
		}
		else if (cardData.SameKindNumMaxInUnlimited == 1)
		{
			_textWarning.gameObject.SetActive(value: true);
			_textWarning.text = systemText.Get("Card_0205");
		}
		else if (cardData.SameKindNumMaxInUnlimited == 2)
		{
			_textWarning.gameObject.SetActive(value: true);
			_textWarning.text = systemText.Get("Card_0206");
		}
		else if (Data.Crossover.IsWithinPracticePeriod)
		{
			int num = Mathf.Min(cardData.SameKindNumMaxInCrossoverMainClass, cardData.SameKindNumMaxInCrossoverSubClass);
			if (num == 0)
			{
				_textWarning.gameObject.SetActive(value: true);
				_textWarning.text = systemText.Get("Card_0277");
			}
			else if (num < FormatBehaviorManager.GetDefaultBehaviour(Format.Crossover).DeckSameKindCardNumMax)
			{
				_textWarning.gameObject.SetActive(value: true);
				_textWarning.text = systemText.Get("Card_0278", num.ToString());
			}
		}
		else
		{
			_textWarning.gameObject.SetActive(value: false);
		}
	}
}
