public void OnPurchaseProductResponse(string bulkReceipt, bool gameIdleControllerEnabled = true) { Service.Get <GameIdleController>().Enabled = gameIdleControllerEnabled; MoneyReceiptVerifyRequest moneyReceiptVerifyRequest = new MoneyReceiptVerifyRequest(); string text = Regex.Unescape(bulkReceipt); text = Regex.Unescape(text); byte[] bytes = Encoding.UTF8.GetBytes(text); string receipt = Convert.ToBase64String(bytes); moneyReceiptVerifyRequest.Receipt = receipt; moneyReceiptVerifyRequest.VendorKey = "Windows"; moneyReceiptVerifyRequest.PlayerId = Service.Get <CurrentPlayer>().PlayerId; MoneyReceiptVerifyCommand command = new MoneyReceiptVerifyCommand(moneyReceiptVerifyRequest); Service.Get <ServerAPI>().Async(command); }
public void OnPurchaseProductResponse(InAppPurchaseReceipt receipt, bool gameIdleControllerEnabled) { if (Service.GameIdleController != null) { Service.GameIdleController.Enabled = gameIdleControllerEnabled; } if (receipt.errorCode != 0u) { return; } MoneyReceiptVerifyRequest moneyReceiptVerifyRequest = new MoneyReceiptVerifyRequest(); moneyReceiptVerifyRequest.Receipt = receipt.GetManimalReceiptString(); moneyReceiptVerifyRequest.VendorKey = "googleV3"; if (!string.IsNullOrEmpty(receipt.userId)) { if (moneyReceiptVerifyRequest.ExtraParams == null) { moneyReceiptVerifyRequest.ExtraParams = new Dictionary <string, string>(); } moneyReceiptVerifyRequest.ExtraParams.Add("userId", receipt.userId); } moneyReceiptVerifyRequest.PlayerId = Service.CurrentPlayer.PlayerId; ServerAPI serverAPI = Service.ServerAPI; MoneyReceiptVerifyCommand moneyReceiptVerifyCommand = new MoneyReceiptVerifyCommand(moneyReceiptVerifyRequest); moneyReceiptVerifyCommand.ProductId = receipt.productId; moneyReceiptVerifyCommand.SetTransactionId(receipt.transactionId); if (!serverAPI.Enabled && Service.CurrentPlayer.CampaignProgress.FueInProgress) { serverAPI.Enabled = true; serverAPI.Sync(moneyReceiptVerifyCommand); serverAPI.Enabled = false; } else { serverAPI.Sync(moneyReceiptVerifyCommand); } }