Example #1
0
    public static void Purchased(string sku, string token, System.Action nextTask)
    {
        var pack = GlobalConfig.Shop.GetPackage(sku);

        if (pack == null)
        {
            nextTask?.Invoke();
            return;
        }

        Profile.EarnGems(pack.gems);
        Profile.Bombs    += pack.bombs;
        Profile.Hammers  += pack.hammers;
        Profile.Missiles += pack.missiles;

        Game.Instance.OpenPopup <Popup_Rewards>().Setup(0, pack.gems, pack.bombs, pack.hammers, pack.missiles, true, false, nextTask);

        PurchaseSystem.Consume(pack.sku, (success, msg) =>
        {
            if (success)
            {
                GlobalAnalytics.NewBuisinessEvent(Online.Purchase.Provider.Market, pack.sku, pack.price, token);
                Online.Stats.Set(GlobalConfig.Instance.version, Profile.Gems, Profile.Skill, Profile.GetLevelsPassed(), r => { });
            }
        });

        GlobalAnalytics.SourceGem(pack.gems, pack.sku.Replace("ameza_", ""));
    }
Example #2
0
    public void OnItemClick(int index)
    {
        var item = gameManager.shopItems[index];

        if (item == null)
        {
            return;
        }

        PurchaseSystem.Purchase(PurchaseProvider.Bazaar, item.sku, (success, msg) =>
        {
            if (success)
            {
                purchaseditem = item;
                PurchaseSystem.Consume();
                StartCoroutine(AddGold(item.gold));
#if DATABEEN
                DataBeen.SendPurchaseData(item.sku, msg);
#endif
            }
        });
    }