private void OnEnable() { if (_priceViewer == null) { _priceViewer = GetComponentInChildren <Text>(); } if (_buyButton == null) { _buyButton = GetComponentInChildren <Button>(); } if (_counter != null) { _counter.text = _booster.Value.ToString("0.##"); } if (_booster.ItemPicture != null) { _productShower.sprite = _booster.ItemPicture; } _buyButton.onClick.AddListener(delegate { ItemChosen?.Invoke(_booster); }); _currensyShower.sprite = _booster.CurrencyPicture; if (!SaveDataStorage.ItemContain(_booster)) { string format = _booster.CurrencyType == CurrencyType.Real ? "0.00#" : "0.##"; _priceViewer.text = _booster.GetItemPrice.ToString(format); } else { _priceViewer.text = "SOLD"; } }
public void ItemShow() { if (!SaveDataStorage.ItemContain(_booster)) { string format = _booster.CurrencyType == CurrencyType.Real ? "0.00#" : "0.##"; _priceViewer.text = _booster.GetItemPrice.ToString(format); } else { _priceViewer.text = "SOLD"; } }
private IEnumerable <Booster> FillingCurrentBooster() { List <Booster> currentBooster = new List <Booster>(); foreach (var booster in _boosters) { if (SaveDataStorage.ItemContain(booster)) { currentBooster.Add(booster); } } return(currentBooster); }
public void ShowPanel(IItem item) { gameObject.SetActive(true); if (_selfAnimator == null) { _selfAnimator = GetComponent <Animator>(); } ShowItemInformation(item); _currentItem = item; Sprite currentButtonSprite = SaveDataStorage.ItemContain(item) ? _buyButtonImage[1] : _buyButtonImage[0]; _confirmButton.GetComponent <Image>().sprite = currentButtonSprite; SetConfirmButtonInteractable(); }
private void SetConfirmButtonInteractable() => _confirmButton.interactable = !SaveDataStorage.ItemContain(_currentItem);