void CheckTouch3(Vector3 pos)
    {
        Vector3 wp = Camera.main.ScreenToWorldPoint(pos);

        hit3 = Physics2D.OverlapPoint(new Vector2(wp.x, wp.y));
        if (hit3 != null && hit3.gameObject == gameObject)
        {
            if (StoreInventory.GetItemBalance("coin_currency_ID") < 5000)
            {
                soundHandler.PlayButtonClickUp();
                GameObject.Find("Heart Purchase Banner(Clone)").GetComponent <PurchaseHeartsBannerController> ().SetInstantiateCoinsScreen(true);
                GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().GetRidOfScreen();
            }
            else
            {
                GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().AddToCoinTotal(-5000);
                GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetHeartNumber(5);
                GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().UpdateCoinNumber();
                soundHandler.PlayCashRegister();
                if (GameObject.Find("Level Controller") == null)
                {
                    GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().SetGetRidOfShade(true);
                }
                else
                {
                    GameObject.Find("Heart Purchase Banner(Clone)").GetComponent <PurchaseHeartsBannerController> ().SetHeartsPurchased();
                }
                GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().GetRidOfScreen();
            }
        }
    }
예제 #2
0
    public void onRestoreTransactionsFinished(bool success)
    {
        if (success)
        {
            //InvokeRepeating("HideAds", 0.1f, 1.0f);
            Debug.Log("restore successful");

            foreach (VirtualGood vg in StoreInfo.Goods)
            {
                Debug.Log(StoreInventory.GetItemBalance(vg.ItemId));
            }


            if (StoreInventory.GetItemBalance(GameAssets.NO_ADS.ItemId) == 1)
            {
                //StoreInventory.EquipVirtualGood(GameAssets.NO_ADS.ItemId);
                InvokeRepeating("HideAds", 0.1f, 1.0f);
                Debug.Log("restore: virtual good found in inventory");
            }
            else
            {
                Debug.Log("restore: virtual good NOT found in inventory");
            }
            //StoreInventory.NonConsumableItemExists(GameAssets.NO_ADS.ItemId);
        }
        else
        {
            Debug.Log("Restore failed");
        }
    }
    /// <summary>
    /// Determines whether the specified character is owned by the player.
    /// </summary>
    public bool IsOwned(CharacterType character)
    {
        // Character is owned if its item balance in the inventory is 1 (non-zero)
        string charItemID = CRCAssets.CharactersLTVGArray[(int)character].ItemId;

        return(StoreInventory.GetItemBalance(charItemID) > 0);
    }
예제 #4
0
 public void OnGameSceneLoaded()
 {
     thisSessionCoins      = 0;
     coinsUntilThisSession = StoreInventory.GetItemBalance
                                 (MashinRunAssets.MASHIN_RUN_CURRENCY_ITEM_ID);
     TraveledDistance = 0f;
 }
예제 #5
0
파일: CBAds.cs 프로젝트: mengtest/soap_game
    // Show ads at the game over screen and unlock death achievements
    public void showGameOverAds()
    {
        go_count++;

        string death_count = go_count.ToString();

        // Unlock achievement for dying specific number of times
        #if UNITY_ANDROID
        switch (death_count)
        {
        case "10":
            Achievements.unlockAchivement(GPGSIds.achievement_just_getting_the_hang_of_it);
            break;

        case "20":
            Achievements.unlockAchivement(GPGSIds.achievement_this_gets_easier_right);
            break;

        case "30":
            Achievements.unlockAchivement(GPGSIds.achievement_masochist);
            break;

        case "50":
            Achievements.unlockAchivement(GPGSIds.achievement_so_much_death);
            break;
        }
        #endif

        if (go_count % ad_frequency == 0 && StoreInventory.GetItemBalance(SOAPStoreAssets.NO_ADS_LIFETIME_PRODUCT_ID) == 0)
        {
            Chartboost.showInterstitial(CBLocation.GameOver);
            Debug.Log("Show the ads now!");
        }
    }
예제 #6
0
파일: CBAds.cs 프로젝트: bigstupidx/SOAP
    // Show ads at the game over screen and unlock death achievements
    public void showGameOverAds()
    {
        go_count++;

        string death_count = go_count.ToString();

        // Unlock achievement for dying specific number of times
        #if UNITY_ANDROID
        switch (death_count)
        {
        case "10":
            Achievements.justGettingTheHangOfItAchievement();
            break;

        case "20":
            Achievements.thisGetsEasierRightAchievement();
            break;

        case "30":
            Achievements.masochistAchievement();
            break;

        case "50":
            Achievements.soMuchDeathAchievement();
            break;
        }
        #endif

        if (go_count % ad_frequency == 0 && StoreInventory.GetItemBalance(SOAPStoreAssets.NO_ADS_LIFETIME_PRODUCT_ID) == 0)
        {
            Chartboost.showInterstitial(CBLocation.GameOver);
            Debug.Log("show the ads now!");
        }
    }
예제 #7
0
    //private int heroIndex;

    public void init(string id, int index, string name, int heroIndex, Sprite img)
    {
        this.index = index;
        this.id    = id;
        //this.heroIndex = heroIndex;
        ch_name.text  = name;
        ch_price.text = AnimineStoreAssets.HEROS_PRICE[heroIndex] + "";
        ch_img.sprite = img;
        buy.onClick.AddListener(() => {
            OnElementBuy();
        });
        select.onClick.AddListener(() => {
            OnEquip();
        });

        if (StoreInventory.GetItemBalance(id) > 0)
        {
            ch_price.gameObject.SetActive(false);
            buy.gameObject.SetActive(false);
            bool selected = StoreInventory.IsVirtualGoodEquipped(id);
            selectedLabel.SetActive(selected);
            select.gameObject.SetActive(!selected);
            //if(selected)
            //GameControl.current.CharacterChanged (index);
        }
    }
예제 #8
0
    // Use this for initialization
    void Start()
    {
        ChartBoostAndroid.onStart();

        StoreController.Initialize(new AndysApplesAssets());

        //if (StoreInventory.GetItemBalance(AndysApplesAssets.SUPER_SEED_GOOD.ItemId) == 0)
        //    StoreInventory.GiveItem(AndysApplesAssets.SUPER_SEED_GOOD.ItemId, 2);

        // Acquire default player skin "Andy" and equip him for use in game.
        // This is is only run on the first startup of the game or if data is deleted.
        if (StoreInventory.GetItemBalance(AndysApplesAssets.ANDY_GOOD.ItemId) == 0)
        {
            StoreInventory.GiveItem(AndysApplesAssets.ANDY_GOOD.ItemId, 1);
            StoreInventory.EquipVirtualGood(AndysApplesAssets.ANDY_GOOD.ItemId);
        }

        // Acquire default background and equip it for use in game.
        // This is is only run on the first startup of the game or if data is deleted.
        if (StoreInventory.GetItemBalance(AndysApplesAssets.DEFAULT_BG.ItemId) == 0)
        {
            StoreInventory.GiveItem(AndysApplesAssets.DEFAULT_BG.ItemId, 1);
            StoreInventory.EquipVirtualGood(AndysApplesAssets.DEFAULT_BG.ItemId);
        }
    }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     balance = StoreInventory.GetItemBalance(ShapeValeStore.NO_ADS_LIFETIME_PRODUCT_ID);
     done    = false;
     tempbox = null;
     removeads.GetComponent <Animator>().SetBool("off", true);
 }
예제 #10
0
 // Use this for initialization
 void Start()
 {
     balance = StoreInventory.GetItemBalance(ShapeValeStore.NO_ADS_LIFETIME_PRODUCT_ID);
     tempbox = null;
     screens = GameObject.FindGameObjectWithTag("screens").gameObject;
     AssignScreens(screens);
     defeated   = false;
     victorious = false;
     paused     = false;
     adz        = null;
     if (GameObject.FindGameObjectWithTag("ads") != null)
     {
         adz = GameObject.FindGameObjectWithTag("ads").gameObject;
     }
     if ((balance > 0) && (adz != null))
     {
         ads.destroystarting();
     }
     if ((balance > 0) && (adz != null) && (ads.destroyending()))
     {
         Destroy(adz);
     }
     {
         //it exists
     }
 }
예제 #11
0
    void OnEnable()
    {
        int batteryUpgradeIndex = StoreInventory.GetGoodUpgradeLevel(AnimineStoreAssets.BATTERY_VG_ITEM_ID);

        BATTERY_DURATION = Constants.BATTERY_DURATION[batteryUpgradeIndex];
        StartCoroutine(countdown(BATTERY_DURATION * StoreInventory.GetItemBalance(AnimineStoreAssets.BATTERY_VG_ITEM_ID)));
    }
예제 #12
0
 public static void UpdateBalances()
 {
     CurrencyBalance = StoreInventory.GetItemBalance(VirtualCurrencies[0].ItemId);
     foreach (VirtualGood vg in VirtualGoods)
     {
         GoodsBalances[vg.ItemId] = StoreInventory.GetItemBalance(vg.ItemId);
     }
 }
예제 #13
0
 // When insufficient funds, page opens shop
 void onNotEnoughTargetItem(VirtualItem item)
 {
     if (item.ItemId == "seed")
     {
         UIServer.main.ShowPage("Store");
     }
     StoreInventory.GetItemBalance(item.ID);
 }
        IEnumerator PopulateNumberOfSmokeBombsDelayed()
        {
            // delay
            yield return(new WaitForEndOfFrame());

            // populate the number of smoke bombs
            inventoryModel.smokeBombsLeft = (StoreInventory.GetItemBalance("more_smokebombs") == 0 ? 3 : 8);
        }
예제 #15
0
 void Start()
 {
     Debug.Log("Bouton publicité caché");
     if (StoreInventory.GetItemBalance(boutique.NO_ADS_LTVG.ItemId) > 0)
     {
         GameObject.Destroy(this.gameObject);
     }
 }
예제 #16
0
 public void OnSoomlaStoreInitialized()
 {
     if (moneyText)
     {
         moneyText.text = StoreInventory.GetItemBalance(MashinRunAssets
                                                        .MASHIN_RUN_CURRENCY_ITEM_ID).ToString();
     }
 }
예제 #17
0
 public void selectIt()
 {
     if (StoreInventory.GetItemBalance(id) > 0)
     {
         bool selected = StoreInventory.IsVirtualGoodEquipped(id);
         selectedLabel.SetActive(selected);
         select.gameObject.SetActive(!selected);
     }
 }
예제 #18
0
    public void UpdateItemDictionary()
    {
        #region Equipment Head

        foreach (Item item in equipmentsHead.Values)
        {
            item.balance = StoreInventory.GetItemBalance(item.itemId);
        }

        #endregion
        #region Equipment Body

        foreach (Item item in equipmentsBody.Values)
        {
            item.balance = StoreInventory.GetItemBalance(item.itemId);
        }

        #endregion
        #region Equipment Legs

        foreach (Item item in equipmentsLegs.Values)
        {
            item.balance = StoreInventory.GetItemBalance(item.itemId);
        }

        #endregion
        #region Items Consumable

        foreach (Item item in itemsConsumable.Values)
        {
            if (item.type != ItemType.currency_pack)
            {
                item.balance = StoreInventory.GetItemBalance(item.itemId);
            }
        }

        #endregion
        #region other items

        foreach (Item item in itemsOther.Values)
        {
            if (item.type != ItemType.currency_pack)
            {
                item.balance = StoreInventory.GetItemBalance(item.itemId);
            }
        }

        #endregion

        foreach (Item item in allItems.Values)
        {
            if (item.type != ItemType.currency_pack)
            {
                item.balance = StoreInventory.GetItemBalance(item.itemId);
            }
        }
    }
예제 #19
0
 public void showAdvertise()
 {
     #if UNITY_IOS || UNITY_ANDROID
     if (StoreInventory.GetItemBalance(boutique.NO_ADS_LTVG.ItemId) <= 0)
     {
         Chartboost.showInterstitial(CBLocation.Default);
     }
     #endif
 }
    /// <summary>
    /// Gives the player the specified character.
    /// </summary>
    public void GiveCharacter(CharacterType character)
    {
        string firstCharID = CRCAssets.CharactersLTVGArray[(int)character].ItemId;

        // Make sure character is not already owned
        if (StoreInventory.GetItemBalance(firstCharID) == 0)
        {
            StoreInventory.GiveItem(firstCharID, 1);
        }
    }
예제 #21
0
 public void OnPlayerDied(Player player)
 {
     thisSessionCoins = StoreInventory.GetItemBalance
                            (MashinRunAssets.MASHIN_RUN_CURRENCY_ITEM_ID)
                        - coinsUntilThisSession;
     if (thisSessionCoins > mostCoins)
     {
         mostCoins = thisSessionCoins;
     }
 }
예제 #22
0
    // Use this for initialization
    void Start()
    {
        itemId  = AndysApplesAssets.ENERGY_POTION_GOOD.ItemId;
        balance = StoreInventory.GetItemBalance(itemId);
        //balance = 1;
        //Debug.Log ("Energy-Powerup Balance at Fast Apples Game Start: " + balance);

        textMesh.text = balance.ToString();
        textMesh.Commit();
    }
 /// <summary>
 /// Checks if this <c>Gate</c> meets its criteria for opening, by checking if the
 /// item's balance has reached the desired balance.
 /// </summary>
 /// <returns>If the <c>Gate</c> meets the criteria to be opened returns <c>true</c>;
 /// otherwise <c>false</c>.</returns>
 protected override bool canOpenInner()
 {
     try {
         return(StoreInventory.GetItemBalance(AssociatedItemId) >= DesiredBalance);
     } catch (VirtualItemNotFoundException e) {
         SoomlaUtils.LogError(TAG, "(canOpenInner) Couldn't find itemId. itemId: " + AssociatedItemId);
         SoomlaUtils.LogError(TAG, e.Message);
         return(false);
     }
 }
예제 #24
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
        {
        }
    }
예제 #25
0
 /// <summary>
 /// Determines whether this instance is premium version.
 /// </summary>
 /// <returns><c>true</c> if this instance is premium version; otherwise, <c>false</c>.</returns>
 public bool IsPremiumVersion()
 {
     if (StoreInventory.GetItemBalance(buyID) > 0)            // 프리미엄 버전을 구매 한 경우
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public void buy()
 {
     if (StoreInventory.GetItemBalance("com.graham.wonderrush.unlock_full") == 0)
     {
         try {
             StoreInventory.BuyItem("com.graham.wonderrush.unlock_full");
         } catch (Exception e) {
         }
     }
     isFullUnlocked();
 }
 private void isFullUnlocked()
 {
     if (StoreInventory.GetItemBalance("com.graham.wonderrush.unlock_full") == 1 && disabledButtons != null)
     {
         disabledButtons.SetActive(false);
         OverallMasterController.Instance().unlocked = true;
     }
     else
     {
     }
 }
예제 #28
0
    public void BuyItem(string itemId)
    {
        int cBalance = StoreInventory.GetItemBalance("charsoo_coin");

        StoreInventory.BuyItem(itemId);

        if (StoreInventory.GetItemBalance("charsoo_coin") > cBalance)
        {
            SoundManager.PlayAudioClip(GiveCoinAudioClip);
        }
    }
예제 #29
0
파일: Store.cs 프로젝트: CoderBear/AAUnity
    public void EquipPirate()
    {
        string itemId = AndysApplesAssets.PIRATE_GOOD.ItemId;

        AndyUtils.LogDebug(TAG, "StoreInventory.IsVirtualGoodEquipped(" + itemId + ") is " + !StoreInventory.IsVirtualGoodEquipped(itemId));
        if (!StoreInventory.IsVirtualGoodEquipped(itemId))
        {
            StoreInventory.EquipVirtualGood(itemId);
            pirate.displayEquipStats(true);

            // turn all others off
            if (StoreInventory.GetItemBalance(AndysApplesAssets.ANDY_GOOD.ItemId) == 1)
            {
                if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.ANDY_GOOD.ItemId))
                {
                    StoreInventory.UnEquipVirtualGood(AndysApplesAssets.ANDY_GOOD.ItemId);
                }
                andy.displayEquipStats(false);
            }
            if (StoreInventory.GetItemBalance(AndysApplesAssets.KELLY_GOOD.ItemId) == 1)
            {
                if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.KELLY_GOOD.ItemId))
                {
                    StoreInventory.UnEquipVirtualGood(AndysApplesAssets.KELLY_GOOD.ItemId);
                }
                kelly.displayEquipStats(false);
            }
            if (StoreInventory.GetItemBalance(AndysApplesAssets.NINJA_GOOD.ItemId) == 1)
            {
                if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.NINJA_GOOD.ItemId))
                {
                    StoreInventory.UnEquipVirtualGood(AndysApplesAssets.NINJA_GOOD.ItemId);
                }
                ninja.displayEquipStats(false);
            }
            if (StoreInventory.GetItemBalance(AndysApplesAssets.PIG_GOOD.ItemId) == 1)
            {
                if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.PIG_GOOD.ItemId))
                {
                    StoreInventory.UnEquipVirtualGood(AndysApplesAssets.PIG_GOOD.ItemId);
                }
                pig.displayEquipStats(false);
            }
            if (StoreInventory.GetItemBalance(AndysApplesAssets.WIZARD_GOOD.ItemId) == 1)
            {
                if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.WIZARD_GOOD.ItemId))
                {
                    StoreInventory.UnEquipVirtualGood(AndysApplesAssets.WIZARD_GOOD.ItemId);
                }
                wizard.displayEquipStats(false);
            }
        }
    }
예제 #30
0
    // Use this for initialization
    void Start()
    {
        hasDisplayed    = false;
        roundScore.text = "Score " + Score.currentScore.ToString();
        highScore.text  = "High Score: " + PlayerPrefs.GetInt("highScore").ToString();
        //Chartboost.Create ();

        Chartboost.setAutoCacheAds(true);

        if (!SoomlaStore.Initialized)
        {
            SoomlaStore.Initialize(new Soomla.Store.GalaxyDefender.GalaxyDefenderAssets());
            SoomlaStore.RefreshInventory();
        }

        ItemBalance = StoreInventory.GetItemBalance("no_ads");

        if (ItemBalance > 0)
        {
            showAd = false;
        }
        else
        {
            showAd = true;
        }

        if (Score.currentScore >= 10000)
        {
            Social.ReportProgress("CgkIl_fbqZ4MEAIQAQ", 100.0f, (bool success) => { });
        }
        if (Score.currentScore >= 100000)
        {
            Social.ReportProgress("CgkIl_fbqZ4MEAIQAg", 100.0f, (bool success) => { });
        }
        if (Score.currentScore >= 250000)
        {
            Social.ReportProgress("CgkIl_fbqZ4MEAIQAw", 100.0f, (bool success) => { });
        }
        if (Score.currentScore >= 500000)
        {
            Social.ReportProgress("CgkIl_fbqZ4MEAIQBA", 100.0f, (bool success) => { });
        }
        if (Score.currentScore >= 1000000)
        {
            Social.ReportProgress("CgkIl_fbqZ4MEAIQBQ", 100.0f, (bool success) => { });
        }
        if (Score.currentScore >= 5000000)
        {
            Social.ReportProgress("CgkIl_fbqZ4MEAIQBw", 100.0f, (bool success) => { });
        }

        Social.ReportScore(Score.currentScore, "CgkIl_fbqZ4MEAIQBg", (bool success) => { });
    }