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); } }
public virtual void handleInventory(GameProduct gameProduct, double quantity) { //string message = "Enjoy your new purchase."; bool doPurchase = false; if (gameProduct.type == GameProductType.rpgUpgrade) { // Add upgrades double val = gameProduct.GetDefaultProductInfoByLocale().quantity; GameProfileRPGs.Current.AddUpgrades(val); doPurchase = true; //message = "Advance your character with your upgrades and get to top of the game"; } else if (gameProduct.type == GameProductType.powerup) { // Add upgrades if (gameProduct.code.Contains("rpg-recharge-full")) { GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressEnergyAndHealth(1f, 1f); //message = "Recharging your health + energy..."; doPurchase = true; } else if (gameProduct.code.Contains("rpg-recharge-health")) { GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressHealth(1f); //message = "Recharging your health..."; doPurchase = true; } else if (gameProduct.code.Contains("rpg-recharge-energy")) { GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressEnergy(1f); //message = "Recharging your health..."; doPurchase = true; } } else if (gameProduct.type == GameProductType.currency) { // Add skraight cash moneh GameStoreController.HandleCurrencyPurchase(gameProduct, quantity); doPurchase = true; } else if (gameProduct.type == GameProductType.access) { // Add skraight cash moneh GameStoreController.HandleAccessPurchase(gameProduct, quantity); doPurchase = true; } else if (gameProduct.type == GameProductType.characterSkin) { // TODO lookup skin and apply /* * GameCharacterSkin skin = GameCharacterSkins.Instance.GetById(productCodeUse); * GameCharacterSkinItemRPG rpg = skin.GetGameCharacterSkinByData(productCharacterUse, weaponType); * if(rpg != null) { * GameProfileCharacters.Current.SetCurrentCharacterCostumeCode(rpg.prefab); * } */ doPurchase = true; } else { // trigger purchased and rewards from the product items handleGameProductItems(gameProduct); doPurchase = true; } if (doPurchase) { GameStoreController.BroadcastPurchaseSuccess( GameStorePurchaseRecord.Create(true, gameProduct, "", "Purchase Successful:" + gameProduct.GetCurrentProductInfoByLocale().display_name, gameProduct.GetCurrentProductInfoByLocale().description, gameProduct.code, quantity)); } }