private static void HandleOnInitComplete(WP8_InAppsInitResult result) { if (result.IsFailed) { return; } _IsInited = true; WP8InAppPurchasesManager.OnInitComplete -= HandleOnInitComplete; foreach (WP8ProductTemplate product in WP8InAppPurchasesManager.instance.products) { if (product.Type == WP8PurchaseProductType.Durable) { if (product.isPurchased) { //The Durable product was purchased, we should check here //if the content is unlocked for our Durable product. Debug.Log("Product " + product.Name + " is purchased"); } } } WP8Dialog.Create("market Initted", "Total products avaliable: " + WP8InAppPurchasesManager.instance.products.Count); }
//-------------------------------------- // Event Handlers //-------------------------------------- private void OnInitComplete(WP8_InAppsInitResult result) { _IsConnected = true; UM_BillingConnectionResult r = new UM_BillingConnectionResult(); r.message = "Inited"; r.isSuccess = true; foreach (UM_InAppProduct product in UltimateMobileSettings.Instance.InAppProducts) { WP8ProductTemplate tpl = WP8InAppPurchasesManager.Instance.GetProductById(product.WP8Id); if (tpl != null) { product.SetTemplate(tpl); if (product.WP8Template.IsPurchased && !product.IsConsumable) { UM_InAppPurchaseManager.SaveNonConsumableItemPurchaseInfo(product); } } } SendServiceConnectedEvent(r); }
private static void HandleOnInitComplete(WP8_InAppsInitResult result) { if (result.IsFailed) { _status = "[Billing Init] Status" + result.IsSucceeded; return; } _IsInited = true; WP8InAppPurchasesManager.OnInitComplete -= HandleOnInitComplete; StringBuilder builder = new StringBuilder(); foreach (WP8ProductTemplate product in WP8InAppPurchasesManager.Instance.Products) { if (product.Type == WP8PurchaseProductType.Durable) { if (product.IsPurchased) { //The Durable product was purchased, we should check here //if the content is unlocked for our Durable product. Debug.Log("Product " + product.Name + " is purchased"); } } builder.AppendLine(string.Format("[PRODUCT] {0} {1} {2} {3}", product.ProductId, product.Name, product.Type.ToString(), product.Price)); } _status = builder.ToString(); WP8Dialog.Create("market Initted", "Total products avaliable: " + WP8InAppPurchasesManager.Instance.Products.Count); }
private static void HandleOnInitComplete(WP8_InAppsInitResult result) { if(result.IsFailed) { return; } _IsInited = true; WP8InAppPurchasesManager.OnInitComplete -= HandleOnInitComplete; foreach(WP8ProductTemplate product in WP8InAppPurchasesManager.instance.products) { if(product.Type == WP8PurchaseProductType.Durable) { if(product.isPurchased) { //The Durable product was purchased, we should check here //if the content is unlocked for our Durable product. Debug.Log("Product " + product.Name + " is purchased"); } } } WP8Dialog.Create("market Initted", "Total products avaliable: " + WP8InAppPurchasesManager.instance.products.Count); }
private void ProductsDetailsDelegate(string data) { WP8_InAppsInitResult result; if (data.Equals(string.Empty)) { Debug.Log("InAppPurchaseManager, you have no avaiable products"); result = new WP8_InAppsInitResult(); OnInitComplete(result); return; } string[] storeData; storeData = data.Split("|" [0]); for (int i = 0; i < storeData.Length; i += 7) { WP8ProductTemplate tpl = new WP8ProductTemplate(); tpl.ImgURL = storeData[i]; tpl.Name = storeData[i + 1]; tpl.ProductId = storeData[i + 2]; tpl.Price = storeData[i + 3]; if (storeData[i + 4].Trim().Length > 0) { tpl.Type = (WP8PurchaseProductType)Enum.Parse(typeof(WP8PurchaseProductType), storeData[i + 4]); } tpl.Description = storeData[i + 5]; tpl.isPurchased = (Boolean)Boolean.Parse(storeData[i + 6]); _products.Add(tpl); } _IsInitialized = true; result = new WP8_InAppsInitResult(); OnInitComplete(result); //Deffered purchases event dispatch foreach (WP8PurchseResponce defferedPurchase in _defferedPurchases) { OnPurchaseFinished(defferedPurchase); } _defferedPurchases.Clear(); }
private void InitCallback(string res) { string[] data = res.Split(new string[] { SPLITTER2 }, StringSplitOptions.None); int status = Int32.Parse(data[0]); WP8_InAppsInitResult result = new WP8_InAppsInitResult(status); if (result.IsSucceeded) { for (int i = 1; i < data.Length; i++) { System.Diagnostics.Debug.WriteLine("Product RAW Data: {0}", data[i]); string[] productInfo = data[i].Split(new string[] { SPLITTER1 }, StringSplitOptions.None); WP8ProductTemplate product = new WP8ProductTemplate(); product.ImgURI = productInfo[0]; product.Name = productInfo[1]; product.ProductId = productInfo[2]; product.Price = productInfo[3]; product.Type = (WP8PurchaseProductType)Enum.Parse(typeof(WP8PurchaseProductType), productInfo[4]); product.Description = productInfo[5]; product.IsPurchased = bool.Parse(productInfo[6]); product.TransactionID = productInfo[7]; _products.Add(product); } _IsInitialized = true; } OnInitComplete(result); #if UNITY_WP8 //Deffered purchases event dispatch foreach (WP8PurchseResponce defferedPurchase in _defferedPurchases) { OnPurchaseFinished(defferedPurchase); } _defferedPurchases.Clear(); #endif }
private void ProductsDetailsDelegate(string data) { WP8_InAppsInitResult result; if(data.Equals(string.Empty)) { Debug.Log("InAppPurchaseManager, you have no avaiable products"); result = new WP8_InAppsInitResult(); OnInitComplete(result); return; } string[] storeData; storeData = data.Split("|" [0]); for ( int i = 0; i < storeData.Length; i += 7 ) { WP8ProductTemplate tpl = new WP8ProductTemplate(); tpl.ImgURL = storeData[i]; tpl.Name = storeData[i + 1]; tpl.ProductId = storeData[i + 2]; tpl.Price = storeData[i + 3]; if (storeData[i+4].Trim().Length > 0) tpl.Type = (WP8PurchaseProductType)Enum.Parse(typeof(WP8PurchaseProductType), storeData[i + 4]); tpl.Description = storeData[i + 5]; tpl.isPurchased = (Boolean)Boolean.Parse(storeData[i + 6]); _products.Add(tpl); } _IsInitialized = true; result = new WP8_InAppsInitResult(); OnInitComplete(result); //Deffered purchases event dispatch foreach (WP8PurchseResponce defferedPurchase in _defferedPurchases) { OnPurchaseFinished(defferedPurchase); } _defferedPurchases.Clear(); }
private void ProductsDetailsDelegate(string data) { WP8_InAppsInitResult result; if (data.Equals(string.Empty)) { Debug.Log("InAppPurchaseManager, you have no avaiable products"); result = new WP8_InAppsInitResult(); dispatch(INITIALIZED, result); OnInitComplete(result); return; } string[] storeData; storeData = data.Split("|" [0]); for (int i = 0; i < storeData.Length; i += 7) { WP8ProductTemplate tpl = new WP8ProductTemplate(); tpl.ImgURL = storeData[i]; tpl.Name = storeData[i + 1]; tpl.ProductId = storeData[i + 2]; tpl.Price = storeData[i + 3]; tpl.Type = (WP8PurchaseProductType)Enum.Parse(typeof(WP8PurchaseProductType), storeData[i + 4]); tpl.Description = storeData[i + 5]; tpl.isPurchased = (Boolean)Boolean.Parse(storeData[i + 6]); _products.Add(tpl); } _IsInitialized = true; result = new WP8_InAppsInitResult(); dispatch(INITIALIZED, result); OnInitComplete(result); }