using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class GameModePriceApplicator : MonoBehaviour { public TextMeshProUGUI label; public string prefix = "?"; public string GameModePriceKey = "?"; private void OnEnable() { RefreshUI(); SettingsManager.OnSettingsChanged.AddListener(RefreshUI); } private void OnDisable() { SettingsManager.OnSettingsChanged.RemoveListener(RefreshUI); } private void RefreshUI() { if (label == null) { Debug.LogError("Лэйбл не установлен", this); return; } //тут надо на фриплей проверять if (SettingsManager.GetBool("Freeplay", false)) {//бесплатная игра label.color = new Vector4(1, 1, 1, 0); } else {//платная игра label.color = new Vector4(1, 1, 1, 1); } int price = PlayerPrefs.GetInt(GameModePriceKey, 10); if (price == 0) { label.text = $"{prefix} БЕСПЛАТНО"; } else { label.text = $"{prefix} {price} {PaymentSystem.ValutaName}"; } } }