Beispiel #1
0
    private void ShowButton(ChooseButtonState state, int price)
    {
        //if (adText.enabled)
        //{
        //    adText.enabled = false;
        //    adImage.enabled = false;
        //}

        //if (priceText.enabled)
        //{
        //    priceText.enabled = false;
        //    priceImage.enabled = false;
        //}

        if (state == ChooseButtonState.Buy)
        {
            chooseButtonText.enabled = true;
            chooseButtonText.text    = "buy";

            chooseButtonText.DOFade(1, 0.6f);


            priceText.enabled  = true;
            priceImage.enabled = true;
            priceText.text     = price.ToString();

            Color c = priceText.color;
            c.a             = 0;
            priceText.color = c;

            c   = priceImage.color;
            c.a = 0;
            priceImage.color = c;

            priceText.DOFade(1, 0.6f);
            priceImage.DOFade(1, 0.6f);

            adText.enabled  = false;
            adImage.enabled = false;


            if (PlayerInfo.info.allCoins < price)
            {
                chooseButton.interactable = false;
                chooseButtonImage.DOFade(0.3f, 0.6f);
                chooseButtonImage.enabled = true;
            }
            else
            {
                chooseButton.interactable = true;
                chooseButtonImage.DOFade(1, 0.6f);
                chooseButtonImage.enabled = true;
            }
        }
        else if (state == ChooseButtonState.Ad)
        {
            adImage.enabled = true;
            adText.enabled  = true;
            adImage.DOFade(1, 0.6f);
            adText.DOFade(1, 0.6f);

            chooseButtonImage.enabled = false;
            chooseButtonText.enabled  = false;

            priceText.enabled  = false;
            priceImage.enabled = false;

            chooseButton.interactable = true;
        }
        else if (state == ChooseButtonState.Activate)
        {
            chooseButtonImage.enabled = true;
            chooseButtonText.enabled  = true;
            chooseButtonText.text     = "activate";
            chooseButtonImage.DOFade(1, 0.6f);
            chooseButtonText.DOFade(1, 0.6f);

            priceText.enabled  = false;
            priceImage.enabled = false;

            adText.enabled  = false;
            adImage.enabled = false;

            chooseButton.interactable = true;
        }
        else if (state == ChooseButtonState.Active)
        {
            chooseButtonText.enabled = true;
            chooseButtonText.text    = "active";
            chooseButtonText.DOFade(1, 0.6f);

            chooseButtonImage.enabled = false;
            priceText.enabled         = false;
            priceImage.enabled        = false;

            adText.enabled            = false;
            adImage.enabled           = false;
            chooseButton.interactable = false;
        }
        else
        {
            chooseButton.interactable = false;
            chooseButtonImage.enabled = false;
            chooseButtonText.enabled  = false;
            adText.enabled            = false;
            adImage.enabled           = false;

            priceText.enabled  = false;
            priceImage.enabled = false;
        }
    }
Beispiel #2
0
    public void ChangeButtonText(int indexOfShape, ShapeChooserController currentStoreShape)
    {
        //make last unlocked shape index

        if (indexOfShape > -1 && indexOfShape <= PlayerInfo.info.lastUnlockedShapeIndex && currentStoreShape != null)
        {
            //if (adText.enabled)
            //{
            //    adText.enabled = false;
            //    adImage.enabled = false;
            //}

            //chooseButton.gameObject.SetActive(true);
            //chooseButtonImage.enabled = true;
            ////chooseButtonText.enabled = true;
            //chooseButtonImage.DOFade(1, 0.6f);

            //chooseButton.interactable = true;



            if (store.IsShapeBought(indexOfShape))
            {
                //priceText.enabled = false;
                //priceImage.enabled = false;
                //chooseButtonText.enabled = true;
                if (indexOfShape == PlayerInfo.info.activePlayerShapeIndex)
                {
                    //chooseButtonImage.enabled = false;
                    //chooseButton.interactable = false;

                    //chooseButtonText.text = "active";
                    currentButtonState = ChooseButtonState.Active;
                }
                else
                {
                    // chooseButtonText.text = "activate";
                    currentButtonState = ChooseButtonState.Activate;
                    //chooseButtonImage.enabled = true;
                    //chooseButtonImage.DOFade(1, 0.6f);
                    // chooseButton.interactable = true;
                }
                // chooseButtonText.DOFade(1, 0.6f);
            }
            else
            {
                if (currentStoreShape.hasAd && Advertisement.IsReady("rewardedVideo"))
                {
                    //isAdReady = true;

                    //chooseButtonText.enabled = false;
                    //chooseButtonImage.enabled = false;
                    //adImage.enabled = true;
                    //adText.enabled = true;

                    //adImage.DOFade(1, 0.6f);
                    //adText.DOFade(1, 0.6f);
                    //chooseButton.interactable = true;
                    currentButtonState = ChooseButtonState.Ad;
                }
                else
                {
                    //isAdReady = false;
                    //priceText.enabled = true;
                    //priceImage.enabled = true;
                    //priceText.text = currentStoreShape.price.ToString();

                    //Color c = priceText.color;
                    //c.a = 0;
                    //priceText.color = c;

                    //c = priceImage.color;
                    //c.a = 0;
                    //priceImage.color = c;

                    //priceText.DOFade(1, 0.6f);
                    //priceImage.DOFade(1, 0.6f);

                    //chooseButtonText.enabled = true;
                    //chooseButtonText.text = "buy";
                    currentButtonState = ChooseButtonState.Buy;
                    //chooseButtonText.DOFade(1, 0.6f);
                    //chooseButtonImage.enabled = true;
                    //chooseButtonImage.DOFade(1, 0.6f);
                    //if (PlayerInfo.info.allCoins < currentStoreShape.price)
                    //{
                    //    chooseButton.interactable = false;
                    //}
                    //else
                    //{
                    //    //chooseButton.interactable = true;
                    //}
                }
            }
        }
        else
        {
            //priceText.enabled = false;
            //priceImage.enabled = false;

            //chooseButtonText.enabled = false;
            //chooseButtonImage.enabled = false;
            //chooseButton.interactable = false;
            //adText.enabled = false;
            //adImage.enabled = false;
            currentButtonState = ChooseButtonState.Inactive;
            //chooseButton.gameObject.SetActive(false);
        }

        int price;

        if (currentStoreShape == null)
        {
            price = 0;
        }
        else
        {
            price = currentStoreShape.price;
        }
        ShowButton(currentButtonState, price);
    }