示例#1
0
    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";
        }
    }
示例#2
0
 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";
     }
 }
示例#3
0
文件: Player.cs 项目: Cromwill/RunMan
    private IEnumerable <Booster> FillingCurrentBooster()
    {
        List <Booster> currentBooster = new List <Booster>();

        foreach (var booster in _boosters)
        {
            if (SaveDataStorage.ItemContain(booster))
            {
                currentBooster.Add(booster);
            }
        }
        return(currentBooster);
    }
示例#4
0
    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();
    }
示例#5
0
 private void SetConfirmButtonInteractable() => _confirmButton.interactable = !SaveDataStorage.ItemContain(_currentItem);