Exemple #1
0
    private void InitStoreData()
    {
        VirtualCurrencies      = StoreInfo.Currencies;
        VirtualGoods           = StoreInfo.Goods;
        VirtualCurrencyPacks   = StoreInfo.CurrencyPacks;
        VirtualGoodsDictionary = new Dictionary <string, VirtualGood>();

        foreach (VirtualGood virtualGood in VirtualGoods)
        {
            VirtualGoodsDictionary.Add(virtualGood.ItemId, virtualGood);
        }

        this.UpdateStoreBalances();

        Debug.Log("GNOME: Notifying Shop Data Initialized");
        this.NotifyShopDataInitialized();

        // Give 10 tokens for free if it's the first time playing
        if (PlayerPrefsFast.GetBool(SharedResources.FirstTimeUserKey, true))
        {
            StoreInventory.GiveItem(GnomeStoreAssets.TokenId, 10);
            PlayerPrefsFast.SetBool(SharedResources.FirstTimeUserKey, false);
            PlayerPrefsFast.Flush();
        }

        this.NotifyTokensChanged();
    }
Exemple #2
0
    public void GiveTokens(int amount)
    {
        this.tokens += amount;
        StoreInventory.GiveItem(GnomeStoreAssets.TokenId, amount);

        this.NotifyTokensChanged();
    }
 public void OnCoinCollected(Coin coin)
 {
     // Debug.Log("give coin");
     //it has huge overhead to be called every few frame
     StoreInventory.GiveItem(MashinRunAssets
                             .MASHIN_RUN_CURRENCY_ITEM_ID, coin.amount);
 }
Exemple #4
0
    public void OnSuccessfulCurrencyResponseReceived(SuccessfulCurrencyResponse response)
    {
        //
        //  CurrencyId: ID of the Virtual Currency defined in the Fyber Dashboard
        //  This example assumes the ID is identical to the Virtual Item ID
        //  defined in your Store Assets Implementation
        //  DeltaOfCoins: Amount of VC to be given
        //
        int amount = (int)response.DeltaOfCoins;

        if (amount > 0)
        {
            StoreInventory.GiveItem(response.CurrencyId, amount);
        }
    }
Exemple #5
0
 public void OnEndEdit(string code)
 {
     if (code.StartsWith("OUMH_04_AD"))
     {
                     #if UNITY_ANDROID || UNITY_EDITOR || UNITY_IOS
         if (StoreInventory.GetItemBalance(boutique.NO_ADS_LTVG.ItemId) == 0)
         {
             StoreInventory.GiveItem(boutique.NO_ADS_LTVG.ItemId, 1);
             feedBack.text = "Suppression des pubs";
         }
                     #endif
         feedBack.text = "Suppression des pubs";
     }
     else if (code.StartsWith("OUMH_04_UNLOCK_"))
     {
         int numLevelADebloquer;
         int numLevel = int.Parse("" + code[15]);
         print(numLevel);
         numLevelADebloquer = GetUnlockerManager().getUnlocker(numLevel);
         feedBack.text      = "Debloquage du niveau n°" + numLevelADebloquer;
         if (numLevelADebloquer != 0)
         {
             PlayerPrefs.SetInt("etoileLevel" + numLevelADebloquer, 3);
         }
     }
     else if (code.StartsWith("OUMH_04_TUTO_"))
     {
         feedBack.text = "Debloquage du tuto n°" + code[15];
         PlayerPrefs.SetInt("niveauReussi" + code[15], 1);
     }
     else if (code.StartsWith("OUMH_04_RESET"))
     {
         feedBack.text = "Réinitialisation du jeu";
         PlayerPrefs.DeleteAll();
                     #if UNITY_ANDROID || UNITY_EDITOR || UNITY_IOS
         if (StoreInventory.GetItemBalance(boutique.NO_ADS_LTVG.ItemId) > 0)
         {
             StoreInventory.TakeItem(boutique.NO_ADS_LTVG.ItemId, StoreInventory.GetItemBalance(boutique.NO_ADS_LTVG.ItemId));
         }
                     #endif
     }
     else
     {
         feedBack.text = "mauvais code";
     }
 }
Exemple #6
0
    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
        case ShowResult.Finished:
            Debug.Log("The ad was successfully shown.");
            //
            // YOUR CODE TO REWARD THE GAMER
            // Give coins etc.
            //MAudioManager.current.PlayFx(AudioName.PurchaseClick);
            StoreInventory.GiveItem(AnimineStoreAssets.GOLD_COIN_VC_ITEM_ID, goldCoinCount);

            break;

        case ShowResult.Skipped:
            Debug.Log("The ad was skipped before reaching the end.");
            break;

        case ShowResult.Failed:
            Debug.LogError("The ad failed to be shown.");
            break;
        }
    }