示例#1
0
        InAppDetail GetIDInfo(string bundleID)
        {
            InAppDetail iad = null;

            foreach (InAppDetail id in InAppInfo)
            {
                if (id.ID.Equals(bundleID))
                {
                    iad = id;
                    break;
                }
            }
            return(iad);
        }
示例#2
0
        void ASKProductListReceived(List <StoreKitProduct> pList)
        {
            if (pList.Count > 0)
            {
                isProductReceived = true;
                MyDebug.Log(" ->" + pList[0].productIdentifier);
            }
            string s = string.Empty;

            foreach (StoreKitProduct skp in pList)
            {
                InAppDetail ipd = GetIDInfo(skp.productIdentifier);
                if (ipd == null)
                {
                    continue;
                }
                ipd.CostStringLocaleBase = skp.formattedPrice;
                s += skp.formattedPrice + '\t' + skp.title + '\t' + skp.productIdentifier + '\t' + skp.description + '\t' + skp.countryCode + '\n';
            }
            s = "\n" + s;
            MyDebug.Log(s);
            SetInAppInfos();
        }
示例#3
0
        void PurchaseSuccessful(string data, string transID, string amazonReceiptId = "")
        {
            MyDebug.Log("InAppManager::PurchaseSuccessful => Item: " + data);
#if AMAZONSTORE && UNDERGROUND
            data = data.Replace("supercell.underground.", "supercell.");
#endif

            switch (data)
            {
            case "balldance.removeads":
                MyDebug.Log("RemoveAds Done");
                //TODO Set your Remove Ads Variable here to save value accros sessions
                AdsMCG.Me.HideBannerAd();
                GameUtility.Me.playerData.isRemoveAds = true;
                if (!isRestore)
                {
#if GOOGLE_TRAK
                    GoogleTracking.Me.LogInApp("Remove Ads", (long)0.99f);
                    GoogleTracking.Me.LogInAppItem(transID, "Remove Ads", data, InAppTypes.NonConsumable.ToString(), (double)0.99f, (long)1);
#endif
                    PopupMessages.Me.PurchaseSuccessfulMessage("Ads have been\nremoved successfully");
                }
                else
                {
                    isRestoreItemSuccess = true;
                }
                break;

            default:
                InAppDetail iad = new InAppDetail();
                iad = GetIDInfo(data);
                if (iad == null)
                {
                    break;
                }
#if GOOGLE_TRAK
                GoogleTracking.Me.LogInApp(iad.DisplayName, (long)iad.CostUSD);
                GoogleTracking.Me.LogInAppItem(transID, iad.DisplayName, data, iad.InAppType.ToString(), (double)iad.CostUSD, (long)1);
#endif
                if (iad.RewardType == RewardTypes.Coin)
                {
                    //TODO: Awared Coins to user
                }
                string coststring;

                coststring = isProductReceived && isLocalStoreCost ? iad.CostStringLocaleBase : "$" + iad.CostUSD;
                string message = "You got {0} coins from\n\"{1}\" for {3}";
                message = string.Format(message, iad.Reward.ToString("n0"), iad.DisplayName, coststring);
                PopupMessages.Me.PurchaseSuccessfulMessage(message);
                break;
            }
#if UNITY_ANDROID && AMAZONSTORE
            if (!isRestore && !string.IsNullOrEmpty(amazonReceiptId))
            {
                NotifyFulfillmentInput nfi = new NotifyFulfillmentInput();
                nfi.ReceiptId         = amazonReceiptId;
                nfi.FulfillmentResult = "FULFILLED";
                iapService.NotifyFulfillment(nfi);
            }
#endif

            GameUtility.Me.SavePlayerData();
            CoreUtility.Me.OnInAppSucess(data);
        }