44 lines
1.2 KiB
C#

using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class RevengeButton : PveLossButton
{
[Header("Layout ссылки")]
[SerializeField] private TextMeshProUGUI oldPrice;
[SerializeField] private TextMeshProUGUI actualPrice;
[SerializeField] private Image saleImage;
public override void Initialize()
{
if (PaymentSystem.Freeplay)
{
oldPrice.gameObject.SetActive(false);
actualPrice.gameObject.SetActive(false);
saleImage.gameObject.SetActive(false);
return;
}
int revengePrice = PaymentSystem.PriceRevengePve;
int normalPrice = PaymentSystem.PricePve;
actualPrice.gameObject.SetActive(true);
actualPrice.text = $"{revengePrice} {PaymentSystem.ValutaName}";
bool revengeCheaper = revengePrice < normalPrice;
oldPrice.gameObject.SetActive(revengeCheaper);
oldPrice.text = $"{normalPrice} {PaymentSystem.ValutaName}";
saleImage.gameObject.SetActive(revengeCheaper);
}
public override void Interact()
{
if (!interactable) return;
base.Interact();
}
}