Exemple #1
0
    public void BuyMinion()
    {
        if (_gm.User.MinionIsInInvetory(_popup.selected))
        {
            return;
        }

        var currency    = _gm.User.Currency;
        var minionValue = _storeInfoData[_popup.selected].currencyValue;

        var dif = currency - minionValue;

        if (dif < 0)
        {
            //Debug.Log("You don't have currency for this buy.");
            return;
        }

        SoundManager.instance.PlaySound(SoundFxNames.upgrade_success);
        _gm.User.BuyMinion(_popup.selected, minionValue);

        //Call again to refresh data.
        UpdatePopupVisualData(true);
        _popup.CheckBuyButton(false, true);
        _popup.SelectMinionByCode(_popup.selected);
    }
Exemple #2
0
    void OnScrollButtonClicked(string desc, bool isBlocked, bool isBought, MinionType type)
    {
        if (isBlocked)
        {
            return;
        }

        if (!isBought)
        {
            shopPopup.DisplayPopup();
            shopPopup.SelectMinionByCode(type);
            return;
        }

        var orderList = _user.GetSquadMinionsOrder();

        if (orderList.Any(i => i == type.ToString()) || orderList.Count == selectedButtons.Count)
        {
            return;
        }

        _user.SetSquadMinionItem(type);

        var selectedItem = selectedButtons.FirstOrDefault(i => i.IsEmpty);

        selectedItem.SetMinion(type, _gm);
        selectedItem.onMinionClick += OnSelectedMinionClickCallback;

        var selectedItemScroll = _totalMinionsList.FirstOrDefault(i => i.minionType == type);

        if (selectedItemScroll != null)
        {
            selectedItemScroll.ChangeToColor(true);
        }
    }