Esempio n. 1
0
        private void ParseProductsFromList(List <InAppPurchaseProductInfo> productInfoList)
        {
            Dictionary <string, InAppPurchaseTypeVO> allIAPTypesByProductID = this.GetAllIAPTypesByProductID();
            int count = productInfoList.Count;

            for (int i = 0; i < count; i++)
            {
                InAppPurchaseProductInfo inAppPurchaseProductInfo = productInfoList[i];
                Service.Logger.Debug("IAP Product: " + inAppPurchaseProductInfo.ToString());
                if (allIAPTypesByProductID.ContainsKey(inAppPurchaseProductInfo.AppStoreId))
                {
                    InAppPurchaseTypeVO inAppPurchaseTypeVO = allIAPTypesByProductID[inAppPurchaseProductInfo.AppStoreId];
                    if (!inAppPurchaseTypeVO.IsPromo)
                    {
                        if (!this.products.ContainsKey(inAppPurchaseProductInfo.AppStoreId))
                        {
                            this.products.Add(inAppPurchaseProductInfo.AppStoreId, inAppPurchaseProductInfo);
                        }
                        if (!this.validIAPTypes.ContainsKey(inAppPurchaseTypeVO.ProductId))
                        {
                            this.validIAPTypes.Add(inAppPurchaseTypeVO.ProductId, inAppPurchaseTypeVO);
                        }
                    }
                }
                else
                {
                    Service.Logger.Debug("IAP Item no longer supported: " + inAppPurchaseProductInfo.AppStoreId);
                }
            }
            Service.Logger.Debug("Number of valid products: " + count);
        }
Esempio n. 2
0
 private static void SwapForOldRubleAbbrev(InAppPurchaseProductInfo iap)
 {
     if (iap == null || string.IsNullOrEmpty(iap.FormattedRealCost))
     {
         return;
     }
     if (iap.FormattedRealCost.Contains("₽"))
     {
         iap.FormattedRealCost = iap.FormattedRealCost.Replace("₽", "\u00a0руб.");
     }
 }
Esempio n. 3
0
        public void OnGetInfoForProducts(string value)
        {
            Dictionary <string, InAppPurchaseTypeVO> allIAPTypesByProductID = this.GetAllIAPTypesByProductID();
            IDictionary <string, object>             dictionary             = new JsonParser(value).Parse() as Dictionary <string, object>;

            if (dictionary != null && dictionary.ContainsKey("products"))
            {
                List <object> list = dictionary.get_Item("products") as List <object>;
                if (list != null)
                {
                    int count = list.Count;
                    for (int i = 0; i < count; i++)
                    {
                        InAppPurchaseProductInfo inAppPurchaseProductInfo = InAppPurchaseProductInfo.Parse(list[i]);
                        Service.Get <StaRTSLogger>().Debug("IAP Product: " + inAppPurchaseProductInfo.ToString());
                        if (allIAPTypesByProductID.ContainsKey(inAppPurchaseProductInfo.AppStoreId))
                        {
                            InAppPurchaseTypeVO inAppPurchaseTypeVO = allIAPTypesByProductID[inAppPurchaseProductInfo.AppStoreId];
                            if (!inAppPurchaseTypeVO.IsPromo)
                            {
                                if (!this.products.ContainsKey(inAppPurchaseProductInfo.AppStoreId))
                                {
                                    this.products.Add(inAppPurchaseProductInfo.AppStoreId, inAppPurchaseProductInfo);
                                }
                                if (!this.validIAPTypes.ContainsKey(inAppPurchaseTypeVO.ProductId))
                                {
                                    this.validIAPTypes.Add(inAppPurchaseTypeVO.ProductId, inAppPurchaseTypeVO);
                                }
                            }
                        }
                        else
                        {
                            Service.Get <StaRTSLogger>().Debug("IAP Item no longer supported: " + inAppPurchaseProductInfo.AppStoreId);
                        }
                    }
                    Service.Get <StaRTSLogger>().Debug("Number of valid products: " + count);
                }
            }
            this.ValidateIAPItems(false);
            if (this.products.Count == this.expectedIAPCount)
            {
                if (this.numStoreRetryAttempts < 1)
                {
                    int num = this.numStoreRetryAttempts - 1;
                    Service.Get <BILoggingController>().TrackGameAction("iap", "get_products_init_success", num.ToString(), "");
                }
                else
                {
                    Service.Get <BILoggingController>().TrackGameAction("iap", "get_products_store_success", this.numStoreRetryAttempts.ToString(), "");
                }
                this.AreProductIdsReady = true;
                Service.Get <EventManager>().SendEvent(EventId.IAPProductIDsReady, null);
            }
        }
Esempio n. 4
0
        public static InAppPurchaseProductInfo Parse(object value)
        {
            InAppPurchaseProductInfo     inAppPurchaseProductInfo = new InAppPurchaseProductInfo();
            IDictionary <string, object> dictionary = value as Dictionary <string, object>;

            inAppPurchaseProductInfo.FormattedRealCost = (dictionary["formattedRealCost"] as string);
            string text = dictionary["realCost"] as string;

            text = Regex.Replace(text, "[^\\s,.0-9]", string.Empty);
            inAppPurchaseProductInfo.RealCost   = text;
            inAppPurchaseProductInfo.Name       = (dictionary["name"] as string);
            inAppPurchaseProductInfo.AppStoreId = (dictionary["appStoreId"] as string);
            if (dictionary.ContainsKey("currencyCode"))
            {
                inAppPurchaseProductInfo.CurrencyCode = (dictionary["currencyCode"] as string);
            }
            return(inAppPurchaseProductInfo);
        }
Esempio n. 5
0
        private void ParseProductsFromJson(string value)
        {
            Dictionary <string, InAppPurchaseTypeVO> allIAPTypesByProductID = this.GetAllIAPTypesByProductID();
            IDictionary <string, object>             dictionary             = new JsonParser(value).Parse() as Dictionary <string, object>;

            if (dictionary != null && dictionary.ContainsKey("products"))
            {
                List <object> list = dictionary["products"] as List <object>;
                if (list != null)
                {
                    int count = list.Count;
                    for (int i = 0; i < count; i++)
                    {
                        InAppPurchaseProductInfo inAppPurchaseProductInfo = InAppPurchaseProductInfo.Parse(list[i]);
                        Service.Logger.Debug("IAP Product: " + inAppPurchaseProductInfo.ToString());
                        if (allIAPTypesByProductID.ContainsKey(inAppPurchaseProductInfo.AppStoreId))
                        {
                            InAppPurchaseTypeVO inAppPurchaseTypeVO = allIAPTypesByProductID[inAppPurchaseProductInfo.AppStoreId];
                            if (!inAppPurchaseTypeVO.IsPromo)
                            {
                                if (!this.products.ContainsKey(inAppPurchaseProductInfo.AppStoreId))
                                {
                                    this.products.Add(inAppPurchaseProductInfo.AppStoreId, inAppPurchaseProductInfo);
                                }
                                if (!this.validIAPTypes.ContainsKey(inAppPurchaseTypeVO.ProductId))
                                {
                                    this.validIAPTypes.Add(inAppPurchaseTypeVO.ProductId, inAppPurchaseTypeVO);
                                }
                            }
                        }
                        else
                        {
                            Service.Logger.Debug("IAP Item no longer supported: " + inAppPurchaseProductInfo.AppStoreId);
                        }
                    }
                    Service.Logger.Debug("Number of valid products: " + count);
                }
            }
        }
Esempio n. 6
0
        public void OnGetInfoForProducts(List <InAppPurchaseProductInfo> productsFromNative)
        {
            Dictionary <string, InAppPurchaseTypeVO> allIAPTypesByProductID = this.GetAllIAPTypesByProductID();
            int count = productsFromNative.Count;

            for (int i = 0; i < count; i++)
            {
                InAppPurchaseProductInfo inAppPurchaseProductInfo = productsFromNative[i];
                Service.Get <StaRTSLogger>().Debug("IAP Product: " + inAppPurchaseProductInfo.ToString());
                InAppPurchaseTypeVO inAppPurchaseTypeVO = allIAPTypesByProductID[inAppPurchaseProductInfo.AppStoreId];
                if (!inAppPurchaseTypeVO.IsPromo)
                {
                    if (!this.products.ContainsKey(inAppPurchaseProductInfo.AppStoreId))
                    {
                        this.products.Add(inAppPurchaseProductInfo.AppStoreId, inAppPurchaseProductInfo);
                    }
                    if (!this.validIAPTypes.ContainsKey(inAppPurchaseTypeVO.ProductId))
                    {
                        this.validIAPTypes.Add(inAppPurchaseTypeVO.ProductId, inAppPurchaseTypeVO);
                    }
                }
            }
            Service.Get <StaRTSLogger>().Debug("Number of valid products: " + count);
            this.ValidateIAPItems(false);
            if (this.products.Count == this.expectedIAPCount)
            {
                if (this.numStoreRetryAttempts < 1)
                {
                    int num = this.numStoreRetryAttempts - 1;
                    Service.Get <BILoggingController>().TrackGameAction("iap", "get_products_init_success", num.ToString(), "");
                }
                else
                {
                    Service.Get <BILoggingController>().TrackGameAction("iap", "get_products_store_success", this.numStoreRetryAttempts.ToString(), "");
                }
                this.AreProductIdsReady = true;
                Service.Get <EventManager>().SendEvent(EventId.IAPProductIDsReady, null);
            }
        }
 public unsafe static long $Invoke6(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(InAppPurchaseProductInfo.Parse(GCHandledObjects.GCHandleToObject(*args))));
 }