From 16ab9e47f93decc61a128f571cc3980acb8a5220 Mon Sep 17 00:00:00 2001 From: sega Date: Thu, 27 Aug 2026 12:55:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BE=D0=BF=D0=BB=D0=B0=D1=82=D1=83=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=BE=D0=B2=20=D0=B2=20PvE=20=D0=B8=20?= =?UTF-8?q?PvP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Gameplay/Panels/PveLossPanel.cs | 7 ++- Assets/Scripts/Gameplay/Panels/PvpWinPanel.cs | 7 ++- .../Scripts/Gameplay/Panels/RevengeButton.cs | 46 +++++++++---------- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/Assets/Scripts/Gameplay/Panels/PveLossPanel.cs b/Assets/Scripts/Gameplay/Panels/PveLossPanel.cs index 8c5d06f..efae7a4 100644 --- a/Assets/Scripts/Gameplay/Panels/PveLossPanel.cs +++ b/Assets/Scripts/Gameplay/Panels/PveLossPanel.cs @@ -63,11 +63,14 @@ public class PveLossPanel : MonoBehaviour, IControlable public void Close() { + int selectedButtonIndex = buttonIndex; + if (selectedButtonIndex == 0 && revengeButton is RevengeButton paidRestartButton && + !paidRestartButton.TryPay(GameMode.pve)) + return; + ControlsEnabled = false; ControlsPerformer.Instance.SetControlable(null); - int selectedButtonIndex = buttonIndex; - if (_animation != null) { diff --git a/Assets/Scripts/Gameplay/Panels/PvpWinPanel.cs b/Assets/Scripts/Gameplay/Panels/PvpWinPanel.cs index b18499b..d960c40 100644 --- a/Assets/Scripts/Gameplay/Panels/PvpWinPanel.cs +++ b/Assets/Scripts/Gameplay/Panels/PvpWinPanel.cs @@ -67,10 +67,13 @@ public class PvpWinPanel : MonoBehaviour, IControlable public void Close() { + int selectedButtonIndex = _buttonIndex; + if (selectedButtonIndex == 0 && !_restartButton.TryPay(GameMode.pvp)) + return; + ControlsEnabled = false; ControlsPerformer.Instance.SetControlable(null); - int selectedButtonIndex = _buttonIndex; _animation?.Kill(); _animation = GetCloseSequence(); _animation.OnComplete(() => CompleteClose(selectedButtonIndex)); @@ -88,7 +91,7 @@ public class PvpWinPanel : MonoBehaviour, IControlable _description.localRotation = Quaternion.identity; _description.GetComponent().text = GetDescription(winner, isMatchWin, player1Score, player2Score); - _restartButton.InitializeForFreeRestart(); + _restartButton.Initialize(GameMode.pvp); _restartButton.transform.localScale = Vector3.zero; _menuButton.transform.localScale = Vector3.zero; _background.color = _backgroundDisabledColor; diff --git a/Assets/Scripts/Gameplay/Panels/RevengeButton.cs b/Assets/Scripts/Gameplay/Panels/RevengeButton.cs index 8f9d740..b964a50 100644 --- a/Assets/Scripts/Gameplay/Panels/RevengeButton.cs +++ b/Assets/Scripts/Gameplay/Panels/RevengeButton.cs @@ -1,50 +1,48 @@ -using System; using TMPro; using UnityEngine; +using UnityEngine.Serialization; using UnityEngine.UI; public class RevengeButton : PveLossButton { [Header("Layout ссылки")] - [SerializeField] private TextMeshProUGUI oldPrice; - [SerializeField] private TextMeshProUGUI actualPrice; - [SerializeField] private Image saleImage; - + [SerializeField, FormerlySerializedAs("oldPrice")] private TextMeshProUGUI _oldPrice; + [SerializeField, FormerlySerializedAs("actualPrice")] private TextMeshProUGUI _actualPrice; + [SerializeField, FormerlySerializedAs("saleImage")] private Image _saleImage; + public override void Initialize() + => Initialize(GameMode.pve); + + public void Initialize(GameMode gameMode) { if (PaymentSystem.Freeplay) { - oldPrice.gameObject.SetActive(false); - actualPrice.gameObject.SetActive(false); - saleImage.gameObject.SetActive(false); + _oldPrice.gameObject.SetActive(false); + _actualPrice.gameObject.SetActive(false); + _saleImage.gameObject.SetActive(false); return; } - int revengePrice = PaymentSystem.PriceRevengePve; - int normalPrice = PaymentSystem.PricePve; + int revengePrice = PaymentSystem.GetRevengePrice(gameMode); + int normalPrice = PaymentSystem.GetModePrice(gameMode); - actualPrice.gameObject.SetActive(true); - actualPrice.text = $"{revengePrice} {PaymentSystem.ValutaName}"; + _actualPrice.gameObject.SetActive(true); + _actualPrice.text = PaymentSystem.GetPluralizedMoney(revengePrice); bool revengeCheaper = revengePrice < normalPrice; - oldPrice.gameObject.SetActive(revengeCheaper); - oldPrice.text = $"{normalPrice} {PaymentSystem.ValutaName}"; - - saleImage.gameObject.SetActive(revengeCheaper); + _oldPrice.gameObject.SetActive(revengeCheaper); + _oldPrice.text = PaymentSystem.GetPluralizedMoney(normalPrice); + _saleImage.gameObject.SetActive(revengeCheaper); } - public void InitializeForFreeRestart() - { - oldPrice.gameObject.SetActive(false); - actualPrice.gameObject.SetActive(false); - saleImage.gameObject.SetActive(false); - } + public bool TryPay(GameMode gameMode) + => PaymentSystem.TryPay(PaymentSystem.GetRevengePrice(gameMode)); public override void Interact() { - if (!interactable) return; + if (!interactable) + return; base.Interact(); - } }