Esempio n. 1
0
    ///Ação de compra executada pelo botão Comprar
    public IEnumerator buyChar(CharType type)
    {
        if (Application.internetReachability != NetworkReachability.NotReachable)
        {
            Powlitico pow = controller.powliticoForCharType(type);

            try{
                //Tento comprar o personagem
                StoreInventory.BuyItem(pow.storeValues.PRODUCT_ID);
            }catch (Exception e) {
                if (purchase)
                {
                    purchase.CloseWindow();
                }

                Debug.Log("unity/soomla:" + e.Message);
            }
        }
        else
        {
            purchase.CloseWindow();
            LoadAlertConnection();
        }
        yield return(null);
    }
Esempio n. 2
0
    void BuyVirtualItem(string itemId)
    {
        if (itemId != null)
        {
            switch (buyItemWith)
            {
            case BuyMethods.VirtualCurrency:
                if (StoreInventory.CanAfford(itemId))
                {
                    StoreInventory.BuyItem(itemId);
                }
                else
                {
                    Debug.Log("You Dont Have Enough Balance to Buy this Product !");
                }
                break;

            case BuyMethods.Upgrade:
                if (StoreInventory.CanAfford(itemId))
                {
                    StoreInventory.UpgradeGood(itemId);
                }
                else
                {
                    Debug.Log("You Dont Have Enough Balance to Buy this Product !");
                }
                break;

            case BuyMethods.Market:
                SoomlaStore.BuyMarketItem(itemId, "Developer Payload");
                break;
            }
        }
    }
Esempio n. 3
0
 public void buyAvatarWithMoney()
 {
     StoreInventory.BuyItem("soap_" + avatar_item_id);
     updatePrices(avatar_item_id);
     // When an avatar is bought automatically select it
     avatar_swap_script.setAvatar(avatar_item_id);
     Debug.Log(string.Format("Just bought a new avatar with money: {0}", avatar_item_id));
 }
Esempio n. 4
0
    public void Buy(GameObject pack)
    {
        SoundBase.Instance.GetComponent <AudioSource>().PlayOneShot(SoundBase.Instance.click);
        SoundBase.Instance.GetComponent <AudioSource>().PlayOneShot(SoundBase.Instance.coins);
        if (pack.name == "Pack1")
        {
            InitScript.waitedPurchaseGems = int.Parse(pack.transform.Find("Count").GetComponent <Text>().text.Replace("x ", ""));
#if UNITY_WEBPLAYER
            InitScript.Instance.PurchaseSucceded();
            CloseMenu();
            return;
#endif
            //	INAPP.Instance.purchaseProduct("pack1");
            //	INAPP.Instance.purchaseProduct("android.test.refunded");
            //      print( StoreInventory.GetItemBalance( SoomlaIntegration.PACK1.ItemId ) );
            StoreInventory.BuyItem(SoomlaIntegration.PACK1.ItemId);
        }

        if (pack.name == "Pack2")
        {
            InitScript.waitedPurchaseGems = int.Parse(pack.transform.Find("Count").GetComponent <Text>().text.Replace("x ", ""));
#if UNITY_WEBPLAYER
            InitScript.Instance.PurchaseSucceded();
            CloseMenu();
            return;
#endif
            //INAPP.Instance.purchaseProduct( "pack2" );
            //	INAPP.Instance.purchaseProduct("android.test.refunded");
            StoreInventory.BuyItem(StoreInfo.CurrencyPacks[1].ItemId);
        }
        if (pack.name == "Pack3")
        {
            InitScript.waitedPurchaseGems = int.Parse(pack.transform.Find("Count").GetComponent <Text>().text.Replace("x ", ""));
#if UNITY_WEBPLAYER
            InitScript.Instance.PurchaseSucceded();
            CloseMenu();
            return;
#endif
            //INAPP.Instance.purchaseProduct( "pack3" );
            //	INAPP.Instance.purchaseProduct("android.test.refunded");
            StoreInventory.BuyItem(StoreInfo.CurrencyPacks[2].ItemId);
        }
        if (pack.name == "Pack4")
        {
            InitScript.waitedPurchaseGems = int.Parse(pack.transform.Find("Count").GetComponent <Text>().text.Replace("x ", ""));
#if UNITY_WEBPLAYER
            InitScript.Instance.PurchaseSucceded();
            CloseMenu();
            return;
#endif
            //INAPP.Instance.purchaseProduct( "pack4" );
            //	INAPP.Instance.purchaseProduct("android.test.refunded");
            StoreInventory.BuyItem(StoreInfo.CurrencyPacks[3].ItemId);
        }
        CloseMenu();
    }
Esempio n. 5
0
        /*
         * void CheckIAP_PurchaseStatus(){
         *
         *      if (StoreInventory.GetItemBalance("no_ads_item_id") >= 1)
         *      {
         *                      //NoAdsIAPOwned  = true;
         *      }
         * }
         */

        public void noadsbuy()
        {
            try {
                StoreInventory.BuyItem("no_ads_item_id");
            }
            catch (Exception e)
            {
                Debug.Log("SOOMLA/UNITY" + e.Message);
            }
        }
Esempio n. 6
0
    public void BuyBackground2()
    {
        string itemId = AndysApplesAssets.CBLOSSOM_BG.ItemId;

        StoreInventory.BuyItem(itemId);
        tracker.AddProgressToAchievement("Change of Scenery", 1.0f);
        tracker.StoreIAPprogress();
        Invoke("DisplayCurrencyInfo", 0.5f);
        blossomBG.allowEquipping();
    }
Esempio n. 7
0
    public void BuySkin6()
    {
        string itemId = AndysApplesAssets.WIZARD_GOOD.ItemId;

        StoreInventory.BuyItem(itemId);
        tracker.AddProgressToAchievement("The Starting Lineups", 1.0f);
        tracker.StoreIAPprogress();
        Invoke("DisplayCurrencyInfo", 0.5f);
        wizard.allowEquipping();
    }
 /// <summary>
 /// Buys a gacha round.
 /// </summary>
 /// <returns>True if successful.</returns>
 public bool BuyGachaRound()
 {
     // Check if balance is enough
     if (CanAffordGacha())
     {
         StoreInventory.BuyItem(CRCAssets.GACHA_ITEM_ID);
         return(true);
     }
     return(false);
 }
Esempio n. 9
0
    // Update is called once per frame
    void Update()
    {
        if (Input.touchCount > 0)
        {
            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
                tempbox = checkTouch(Input.GetTouch(0).position);
            }
        }

        if (tempbox == shopbutton)
        {
            tempbox = null;
            shopbutton.SetActive(false);
            shopoption.SetActive(true);
            removeads.GetComponent <Animator>().SetBool("off", false);
            removeads.GetComponent <Collider2D>().enabled = true;
            start.SetActive(false);
            balance = StoreInventory.GetItemBalance(ShapeValeStore.NO_ADS_LIFETIME_PRODUCT_ID);
        }
        if (tempbox == close)
        {
            tempbox = null;
            shopbutton.SetActive(true);
            shopoption.SetActive(false);
            start.SetActive(true);
            removeads.GetComponent <Collider2D>().enabled = false;
            removeads.GetComponent <Animator>().SetBool("off", true);
            balance = StoreInventory.GetItemBalance(ShapeValeStore.NO_ADS_LIFETIME_PRODUCT_ID);
        }
        if (tempbox == removeads)
        {
            Debug.Log("test");
            tempbox = null;
            VirtualGood no_ads = ShapeValeStore.NO_ADS_LTVG;
            try{
                StoreInventory.BuyItem(no_ads.ItemId);
            }catch (Exception e) {
                Debug.Log("error occured: " + e);
            }
        }

        if (balance > 0)
        {
            if ((removeads.activeSelf) && (!done))
            {
                removeads.GetComponent <Animator>().SetBool("purchased", true);
                removeads.GetComponent <Collider2D>().enabled = false;
                done = true;
            }
        }
        else
        {
        }
    }
 public void buy()
 {
     if (StoreInventory.GetItemBalance("com.graham.wonderrush.unlock_full") == 0)
     {
         try {
             StoreInventory.BuyItem("com.graham.wonderrush.unlock_full");
         } catch (Exception e) {
         }
     }
     isFullUnlocked();
 }
Esempio n. 11
0
    public void BuyItem(string itemId)
    {
        int cBalance = StoreInventory.GetItemBalance("charsoo_coin");

        StoreInventory.BuyItem(itemId);

        if (StoreInventory.GetItemBalance("charsoo_coin") > cBalance)
        {
            SoundManager.PlayAudioClip(GiveCoinAudioClip);
        }
    }
Esempio n. 12
0
        public void Buy1000Coins()
        {
            try {
                Debug.Log("attempt to purchase");

                StoreInventory.BuyItem("1000_coins");                                                                                           // if the purchases can be completed sucessfully
            }
            catch (Exception e)
            {                                                                                                                                                                                           // if the purchase cannot be completed trigger an error message connectivity issue, IAP doesnt exist on ItunesConnect, etc...)
                Debug.Log("SOOMLA/UNITY" + e.Message);
            }
        }
Esempio n. 13
0
 public void BuySeason()
 {
     Debug.Log("__Buying Season....");
     if (Data.Instance.userData.GetTournamentAvailable() == 1)
     {
         StoreInventory.BuyItem(StoreAssets.SEASON_2_UNLOCK_PRODUCT_ID);
     }
     else
     {
         StoreInventory.BuyItem(StoreAssets.SEASON_3_UNLOCK_PRODUCT_ID);
     }
 }
    private void OnClick()
    {
#if UNITY_ANDROID
        // Prevent clicking if the Ad is visible (one of the gotchas for Chartboost on Android)
        if (AdManager.Instance != null && AdManager.Instance.IsImpressionVisible())
        {
            return;
        }
#endif

        StoreInventory.BuyItem(this.ItemId);
    }
Esempio n. 15
0
    void OnElementBuy()
    {
        if (StoreInventory.CanAfford(id))
        {
//			MAudioManager.current.PlayFx (AudioName.PurchaseClick);
            StoreInventory.BuyItem(id);
            bought();
        }
//		} else {
//			GameObject.FindGameObjectWithTag(Constants.TAG_HUD).GetComponent<HUD>().OpenMenu((int) MenuState.Shop_GoldFishMenu);
//		}
    }
Esempio n. 16
0
    public void BuyEnergy()
    {
        string ItemId  = AndysApplesAssets.ENERGY_POTION_GOOD.ItemId;
        int    balance = LocalStoreInfo.GoodsBalances[ItemId];

        if (balance < 99)
        {
            StoreInventory.BuyItem(ItemId);
        }
        energyBalance.text = StoreInventory.GetItemBalance(ItemId).ToString();
        Invoke("DisplayCurrencyInfo", 1.0f);
    }
Esempio n. 17
0
    public void BuySeed()
    {
        string ItemId  = AndysApplesAssets.SUPER_SEED_GOOD.ItemId;
        int    balance = LocalStoreInfo.GoodsBalances[ItemId];

        if (balance < 99)
        {
            StoreInventory.BuyItem(ItemId);
        }
        seedBalance.text = StoreInventory.GetItemBalance(ItemId).ToString();
        Invoke("DisplayCurrencyInfo", 1.0f);
    }
Esempio n. 18
0
 public void BuyCurrencyPack(VirtualCurrencyPack virtualCurrency)
 {
     Debug.Log("SOOMLA/UNITY wants to buy: " + virtualCurrency.Name);
     try
     {
         StoreInventory.BuyItem(virtualCurrency.ItemId);
     }
     catch (Exception e)
     {
         Debug.LogError("SOOMLA/UNITY " + e.Message);
     }
 }
Esempio n. 19
0
 public void BuyVirtualGood(VirtualGood virtualGood)
 {
     Debug.Log("SOOMLA/UNITY wants to buy: " + virtualGood.Name);
     try
     {
         StoreInventory.BuyItem(virtualGood.ItemId);
     }
     catch (Exception e)
     {
         Debug.LogError("SOOMLA/UNITY " + e.Message);
     }
 }
Esempio n. 20
0
    public static void PurchaseUpgrade(int paymentOption)
    {
        // purchase upgrade through Soomla store
        StoreInventory.BuyItem(SoomlaStoreAssets.UNLOCK_ALL_LEVELS_ITEM_ID);
        MonoBehaviour.print("Purchasing upgrade!");

#if UNITY_EDITOR
        // if you're in the editor, just send the callback immediately
        PurchaseUpgrade_callback(true);
        MonoBehaviour.print("Just approve it (unity editor)");
#endif
    }
Esempio n. 21
0
    void ItemInner(Item item, int index)
    {
        if (item.itemId != "empty")
        {
            if (item.icon != null)
            {
                GUI.DrawTexture(itemIconRect, item.icon);
            }
            else
            {
                GUI.DrawTexture(itemIconRect, tempIcon);
            }

            if (goodButton(itemInnerContainerRect, "", activeSkin.button))
            {
                if (selected_item == index)
                {
                    selected_item = 0;
                    HideBubble();
                }
                else
                {
                    selected_item = index;
                    ShowBubble();
                }
            }
            if (selected_item == index && selected_item != 0)
            {
                GUI.DrawTexture(itemIconRect, highlightTexture);
            }

            if (item.currency == CurrencyType.Dollar)
            {
                if (goodButton(itemBtnRect, item.dollarPrice.ToString(), dollarPurchaseBtnStyle))
                {
                    StoreInventory.BuyItem(item.itemId);
                }
            }

            /*
             * if (item.type != ItemType.item_consumable &&
             *  item.type != ItemType.item_instant &&
             *  item.balance == 1)
             * {
             *  GUI.DrawTexture(itemInnerContainerRect, soldOutTexture, ScaleMode.ScaleToFit);
             * }
             */
        }
        else
        {
            GUI.DrawTexture(itemInnerContainerRect, soldOutTexture, ScaleMode.ScaleToFit);
        }
    }
Esempio n. 22
0
    public void purchasePacket3()
    {
        if (GameData.Instance.isMusicON != 0)
        {
            SoundManager.instance.PlaySingle(menuClip);
        }

        try {
            Debug.Log(StoreInventory.GetItemBalance(NumberGameAssets.PACKET3_ITEM_ID));
            StoreInventory.BuyItem(NumberGameAssets.PACKET3_ITEM_ID);
        } catch (System.Exception ex) {
            Debug.Log("SOOMLA/UNITY" + ex.Message);
        }
    }
Esempio n. 23
0
    public void BuyEnergy(int qty)
    {
        Events.OnLoading(true);
        switch (qty)
        {
        case 1:     StoreInventory.BuyItem(StoreAssets.ENERGY_1_PRODUCT_ID); break;

        case 3:     StoreInventory.BuyItem(StoreAssets.ENERGY_3_PRODUCT_ID); break;

        case 10:    StoreInventory.BuyItem(StoreAssets.ENERGY_10_PRODUCT_ID); break;

        case 50:    StoreInventory.BuyItem(StoreAssets.ENERGY_50_PRODUCT_ID); break;
        }
    }
Esempio n. 24
0
 public bool BuyItem(string itemID)
 {
     try
     {
         // this is the plugin
         StoreInventory.BuyItem(itemID);
         return(true);
     }
     catch (Exception e)
     {
         Debug.Log("UNITY/SOOMLA/BUY_ITEM:  " + e.Message);
         return(false);
     }
 }
        /// <summary>
        /// Opens this <c>Gate</c> by buying its associated item.
        /// </summary>
        /// <returns>If purchase was successfully made returns <c>true</c>; otherwise
        /// <c>false</c>.</returns>
        protected override bool openInner()
        {
            try {
                StoreInventory.BuyItem(AssociatedItemId, this._id);
                return(true);
            } catch (VirtualItemNotFoundException e) {
                SoomlaUtils.LogError(TAG, "The item needed for purchase doesn't exist. itemId: " +
                                     AssociatedItemId);
                SoomlaUtils.LogError(TAG, e.Message);
            } catch (InsufficientFundsException e) {
                SoomlaUtils.LogError(TAG, "There's not enough funds to purchase this item. itemId: " +
                                     AssociatedItemId);
                SoomlaUtils.LogError(TAG, e.Message);
            }

            return(false);
        }
Esempio n. 26
0
 public void RequestBuy()
 {
     if (!onRequest)
     {
         try
         {
             onRequest = true;
             //buyID = productID;
             StoreInventory.BuyItem(buyID);
         }
         catch (Exception e)
         {
             onRequest = false;
             Debug.Log("Exception : " + e.Message);
         }
     }
 }
Esempio n. 27
0
 public void buy(String name)
 {
     Debug.Log("called");
     foreach (VirtualGood vg in StoreInfo.Goods)
     {
         if (vg.Name == name)
         {
             try {
                 Debug.Log(vg.Name);
                 Debug.Log("BuyItem called.");
                 StoreInventory.BuyItem(vg.ItemId);
             } catch (Exception e) {
                 Debug.Log("SOOMLA" + e.Message);
             }
         }
     }
 }
Esempio n. 28
0
 void _OnElementBuy()
 {
     if (upgrades)
     {
         int upgdLevel = StoreInventory.GetGoodUpgradeLevel(id);
         if (StoreInventory.GetItemBalance(AnimineStoreAssets.GOLD_COIN_VC_ITEM_ID) >= AnimineStoreAssets.UPGRADE_PRICE[upgdLevel])
         {
             StoreInventory.UpgradeGood(id);
         }
     }
     else
     {
         if (StoreInventory.CanAfford(id) && StoreInventory.GetItemBalance(id) < 5)
         {
             //MAudioManager.current.PlayFx (AudioName.PurchaseClick);
             StoreInventory.BuyItem(id);
         }
     }
 }
        public override void Execute()
        {
            string storeID = "";

            if (iapButton == TeamBrookvale.UI.InGameMenuModel.IAPButton.UnlockAllLevels)
            {
                storeID = "unlock_all_levels";
            }

            if (iapButton == TeamBrookvale.UI.InGameMenuModel.IAPButton.MoreSmokeBombs)
            {
                storeID = "more_smokebombs";

                // add more smokebombs just for this level even if the player has not paid for it
                inventoryModel.moreSmokeBombsForJustNow();
            }

            StoreInventory.BuyItem(storeID);
        }
Esempio n. 30
0
    public void Buy(string id)
    {
        switch (id)
        {
        case "socko_450_coins":
            VirtualGood item = goods[0];
            try { StoreInventory.BuyItem(item.ItemId); } catch (Exception e) {
            }
            break;


        case "socko_1000_coins":
            VirtualGood coins1000 = goods[1];
            try { StoreInventory.BuyItem(coins1000.ItemId); } catch (Exception e) {
            }
            break;

        case "socko_2750_coins":
            VirtualGood coins2750 = goods[2];
            try { StoreInventory.BuyItem(coins2750.ItemId); } catch (Exception e) {
            }
            break;

        case "socko_6000_coins":
            VirtualGood coins6000 = goods[3];
            try { StoreInventory.BuyItem(coins6000.ItemId); } catch (Exception e) {
            }
            break;

        case "socko_10000_coins":
            VirtualGood coins10000 = goods[4];
            try { StoreInventory.BuyItem(coins10000.ItemId); } catch (Exception e) {
            }
            break;

        case "socko_remove_ads":
            VirtualGood remove_ads = goods[5];
            try { StoreInventory.BuyItem(remove_ads.ItemId); } catch (Exception e) {
            }
            break;
        }
    }