Beispiel #1
0
    public void OnClick()
    {
        MainAuidoManager.mainAudio.PlayClickSound();
        int currentIndex = SwipeInput.currentIndex;

        currentShape = store.GetShape(currentIndex);
        chooseButton.interactable = false;
        if (currentButtonState == ChooseButtonState.Activate)
        {
            store.ChooseActiveShape(currentIndex);
            ChangeButtonText(currentIndex, currentShape);
        }
        else if (currentButtonState == ChooseButtonState.Ad)
        {
            ShowRewardedAd();
        }
        else if (currentButtonState == ChooseButtonState.Buy)
        {
            store.Buy(currentIndex);
            ChangeButtonText(currentIndex, currentShape);
            store.moneyController.ChangeMoney(-currentShape.price);
        }


        //if (store.IsShapeBought(currentIndex))
        //{
        //    if (currentIndex != PlayerInfo.info.activePlayerShapeIndex)
        //    {
        //        //the shape is activated
        //        store.ChooseActiveShape(currentIndex);
        //        ChangeButtonText(currentIndex, currentShape);
        //    }
        //}
        //else
        //{
        //    if (currentIndex <= PlayerInfo.info.lastUnlockedShapeIndex)
        //    {
        //        if (isAdReady)
        //        {
        //            ShowRewardedAd();
        //        }
        //        else if (PlayerInfo.info.allCoins >= currentShape.price)
        //        {
        //            store.Buy(currentIndex);
        //            ChangeButtonText(currentIndex, currentShape);
        //            store.moneyController.ChangeMoney(-currentShape.price);
        //        }
        //        else
        //        {
        //            messages.ShowErrorMessage(notEnoughMoney);
        //        }

        //    }
        //}
        //chooseButton.interactable = false;
    }