public void Add(GameStorePurchaseDataItem dataItem) { if (!items.Contains(dataItem)) { items.Add(dataItem); } }
public virtual void onStoreThirdPartyPurchaseSuccess(GameStorePurchaseRecord data) { LogUtil.Log("onStoreThirdPartyPurchaseSuccess"); if (data != null) { LogUtil.Log("onStoreThirdPartyPurchaseSuccess: data.messageTitle:" + data.messageTitle); UINotificationDisplay.QueueInfo(data.messageTitle, data.messageDescription); } GameProduct product = GameProducts.Instance.GetProductByPlaformProductCode(data.productId); if (product == null) { return; } GameStorePurchaseDataItem itemPurchasing = GetItemPurchasing(product.code); if (itemPurchasing != null) { LogUtil.Log("onStoreThirdPartyPurchaseSuccess: itemPurchasing.product:" + itemPurchasing.product.code); if (product.type == GameProductType.currency) { GameStoreController.HandleCurrencyPurchase(itemPurchasing.product, itemPurchasing.quantity); } else if (product.type == GameProductType.access) { GameStoreController.HandleAccessPurchase(itemPurchasing.product, itemPurchasing.quantity); } ResetPurchase(itemPurchasing.product.code); } }
// QUEUE/PROCESSING public void SetItemPurchasing(string key, GameStorePurchaseDataItem item) { LogUtil.Log("SET SetItemPurchasing:" + " key:" + key + " item.product.code:" + item.product.code); LogUtil.Log("BEFORE SetItemPurchasing:" + " itemsPurchasing:" + itemsPurchasing.ToJson()); itemsPurchasing.Set <string, GameStorePurchaseDataItem>(key, item); LogUtil.Log("AFTER SetItemPurchasing:" + " itemsPurchasing:" + itemsPurchasing.ToJson()); }
public static GameStorePurchaseData PurchaseData(string productCode, double quantity) { GameStorePurchaseData data = new GameStorePurchaseData(); GameStorePurchaseDataItem dataItem = new GameStorePurchaseDataItem(); dataItem.gameStorePurchaseType = ProductNetworkType.typeLocal; dataItem.product = GameProducts.Instance.GetById(productCode); dataItem.quantity = quantity; data.Add(dataItem); return(data); }
public GameStorePurchaseDataItem GetItemPurchasing(string key) { LogUtil.Log("GET GetItemPurchasing:" + " key:" + key); LogUtil.Log("BEFORE GetItemPurchasing:" + " itemsPurchasing:" + itemsPurchasing.ToJson()); GameStorePurchaseDataItem itemPurchasing = itemsPurchasing.Get <GameStorePurchaseDataItem>(key); LogUtil.Log("AFTER GetItemPurchasing:" + " itemsPurchasing:" + itemsPurchasing.ToJson() + " itemPurchasing:" + itemPurchasing.ToJson()); return(itemPurchasing); }
public virtual void onStorePurchaseFailed(GameStorePurchaseRecord data) { if (data == null) { return; } GameStorePurchaseDataItem itemPurchasing = GetItemPurchasing(data.productId); if (itemPurchasing != null) { ResetPurchase(itemPurchasing.product.code); } UINotificationDisplay.QueueError(data.messageTitle, data.messageDescription); }
public void onProductPurchaseCancelled(ProductNetworkRecord record) { LogUtil.Log("onProductPurchaseSuccess:" + " record:" + record.ToJson()); if (record == null) { LogUtil.Log("record not found"); return; } GameProduct product = GameProducts.Instance.GetProductByPlaformProductCode(record.productId); if (product == null) { LogUtil.Log("Product not found:" + record.productId); return; } GameStorePurchaseDataItem itemPurchasing = GetItemPurchasing(product.code); if (itemPurchasing == null) { LogUtil.Log("itemPurchasing not found:" + product.code); LogUtil.Log("itemsPurchasing:" + itemsPurchasing.ToJson()); } if (itemPurchasing != null) { GameStorePurchaseRecord data = GameStorePurchaseRecord.Create( false, record.data, record.receipt, "Purchase CANCELLED:" + itemPurchasing.product.GetCurrentProductInfoByLocale().display_name, itemPurchasing.product.GetCurrentProductInfoByLocale().description, product.code, record.quantity); GameStoreController.BroadcastThirdPartyPurchaseCancelled(data); } }
public virtual void onStoreThirdPartyPurchaseFailed(GameStorePurchaseRecord data) { if (data != null) { LogUtil.Log("onStoreThirdPartyPurchaseFailed: data.messageTitle:" + data.messageTitle); UINotificationDisplay.QueueInfo(data.messageTitle, data.messageDescription); } GameProduct product = GameProducts.Instance.GetProductByPlaformProductCode(data.productId); if (product == null) { return; } GameStorePurchaseDataItem itemPurchasing = GetItemPurchasing(product.code); if (itemPurchasing != null) { LogUtil.Log("onStoreThirdPartyPurchaseFailed: itemPurchasing.product:" + itemPurchasing.product.code); ResetPurchase(itemPurchasing.product.code); } }