public virtual void RebornByCoin()
 {
     if (CoinManager.totalCoin >= rebornByCoinTotalCost)
     {
         CoinManager.Add(-rebornByCoinTotalCost);
         Reborn();
     }
 }
Esempio n. 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         coinManager.Add(coinValue);
         uiManager.UpdateCoinLabel();
         Destroy(gameObject);
     }
 }
 public void OnCoinAdsButtonClick()
 {
     AdsManager.ShowVideoReward((s) =>
     {
         if (s == AdEvent.Success)
         {
             CoinManager.Add(DataManager.GameConfig.coinAdsReward);
         }
     }, "Select_Mode", "select_mode_coin_" + DataManager.GameConfig.coinAdsReward);
 }
Esempio n. 4
0
    public override void OnShowResult()
    {
        SuggestionAds();
        ShowButton();
        DOStarsAnimation(() =>
                         DOScoreAnimation(() =>
                                          DONumberAnimation(() =>
        {
            Status = UIAnimStatus.IsShow;
        })));

        CoinManager.Add(DataManager.GameConfig.coinPerStage);
    }
 public void _BtnCloneOnClickWater()
 {
     if (CoinManager.totalCoin >= 60)
     {
         CoinManager.Add(-60);
         DataManager.StagesAsset.list[5].isUnlocked = true;
         ButtonPlay.gameObject.SetActive(true);
         ButtonClone.gameObject.SetActive(false);
         ButtonWater.gameObject.SetActive(false);
         GameStateManager.LoadGame(null);
         UIcontro.uIcontro.ChangeUI(UIcontro.MenuUI.Home);
     }
     else
     {
         Debug.Log("huhu");
     }
 }
Esempio n. 6
0
 public void SetCoinButton()
 {
     button.onClick.RemoveAllListeners();
     playObject.SetActive(false);
     priceObject.SetActive(false);
     adsObject.SetActive(true);
     button.onClick.AddListener(() =>
     {
         AdsManager.ShowVideoReward((s) =>
         {
             if (s == AdEvent.Success)
             {
                 CoinManager.Add(DataManager.GameConfig.coinAdsReward);
             }
         }, "Select_Item", "select_item_coin_" + DataManager.GameConfig.coinAdsReward);
     });
     this.gameObject.SetActive(true);
 }
Esempio n. 7
0
    public void SetButton(SkinData skinData)
    {
        button.onClick.RemoveAllListeners();

        if (skinData.isUnlocked)
        {
            playObject.SetActive(true);
            priceObject.SetActive(false);

            button.onClick.AddListener(() =>
            {
                DataManager.CurrentSkin.isSelected = false;
                DataManager.CurrentSkin            = skinData;
                DataManager.CurrentSkin.isSelected = true;
                GameUIManager.SelectSkinScreen.Hide();
            });
        }
        else
        {
            Debug.Log("Skin " + skinData.name + " not unlocked");
            playObject.SetActive(false);
            priceObject.SetActive(true);

            int unlockRequire = 0;

            switch (skinData.unlockType)
            {
            case UnlockType.Ads:
                priceIcon.sprite = iconAds;
                unlockRequire    = (skinData.unlockPrice - skinData.unlockPay);
                break;

            case UnlockType.Gem:
                priceIcon.sprite = iconGem;
                break;

            case UnlockType.Gold:
                priceIcon.sprite = iconGold;
                unlockRequire    = skinData.unlockPrice;
                break;

            case UnlockType.Star:
                priceIcon.sprite = iconStar;
                break;
            }

            priceNumber.text = unlockRequire.ToString();

            button.onClick.AddListener(() =>
            {
                switch (skinData.unlockType)
                {
                case UnlockType.Ads:

                    AdsManager.ShowVideoReward((s) =>
                    {
                        if (s == AdEvent.Success)
                        {
                            var unlockPlayed = skinData.unlockPay++;
                            if (unlockPlayed >= skinData.unlockPrice - 1)
                            {
                                skinData.isUnlocked = true;
                            }

                            SetButton(skinData);
                        }
                    }, "Select_Item", "select_skin_" + skinData.id);

                    break;

                case UnlockType.Gem:
                    break;

                case UnlockType.Gold:
                    if (CoinManager.totalCoin >= skinData.unlockPrice)
                    {
                        CoinManager.Add(-skinData.unlockPrice);
                        skinData.isUnlocked = true;
                    }
                    else
                    {
                        Debug.Log("Not enought coin");
                    }

                    SetButton(skinData);

                    break;

                case UnlockType.Star:
                    break;
                }
            });
        }
        this.gameObject.SetActive(true);
    }
Esempio n. 8
0
    public void SetButton(ItemData itemData)
    {
        button.onClick.RemoveAllListeners();

        if (itemData.isUnlocked)
        {
            playObject.SetActive(true);
            priceObject.SetActive(false);
            adsObject.SetActive(false);

            button.onClick.AddListener(() =>
            {
                PlayerPrefs.SetInt(Constant.IS_RANDOM_ITEM_PREFS, 0);

                DataManager.CurrentItem.isSelected = false;
                DataManager.CurrentItem            = itemData;
                DataManager.CurrentItem.isSelected = true;
                imageHome.sprite = DataManager.CurrentItem.thumbnail;
                imageHome.SetNativeSize();
                if (UIcontro.uIcontro.backtoLoadgame == true)
                {
                    GameStateManager.LoadGame(null);
                    UIcontro.uIcontro.backtoLoadgame = false;
                    UIcontro.uIcontro.ChangeUI(UIcontro.MenuUI.Home);
                }
                else
                {
                    UIcontro.uIcontro.ChangeUI(UIcontro.MenuUI.Home);
                }
            });
        }
        else
        {
            Debug.Log("Item " + itemData.name + " not unlocked");

            playObject.SetActive(false);
            priceObject.SetActive(true);
            adsObject.SetActive(false);

            int unlockRequire = 0;

            switch (itemData.unlockType)
            {
            case UnlockType.Ads:
                priceIcon.sprite = iconAds;
                unlockRequire    = (itemData.unlockPrice - itemData.unlockPay);
                break;

            case UnlockType.Gem:
                priceIcon.sprite = iconGem;
                break;

            case UnlockType.Gold:
                priceIcon.sprite = iconGold;
                unlockRequire    = itemData.unlockPrice;
                break;

            case UnlockType.Star:
                priceIcon.sprite = iconStar;
                break;
            }

            priceNumber.text = unlockRequire.ToString();

            button.onClick.AddListener(() =>
            {
                switch (itemData.unlockType)
                {
                case UnlockType.Ads:

                    AdsManager.ShowVideoReward((s) =>
                    {
                        if (s == AdEvent.Success)
                        {
                            var unlockPlayed = itemData.unlockPay++;
                            if (unlockPlayed >= itemData.unlockPrice - 1)
                            {
                                itemData.isUnlocked = true;
                            }

                            SetButton(itemData);
                        }
                    }, "Select_Item", "select_item_" + itemData.id);


                    break;

                case UnlockType.Gem:
                    break;

                case UnlockType.Gold:
                    if (CoinManager.totalCoin >= itemData.unlockPrice)
                    {
                        CoinManager.Add(-itemData.unlockPrice);
                        itemData.isUnlocked = true;
                    }
                    else
                    {
                        Debug.Log("Not enought coin");
                    }

                    SetButton(itemData);

                    break;

                case UnlockType.Star:
                    break;
                }
            });
        }
        this.gameObject.SetActive(true);
    }