gfg hai 1 ano
pai
achega
0da24afc25
Modificáronse 1 ficheiros con 17 adicións e 4 borrados
  1. 17 4
      GameClient/Assets/Game/HotUpdate/Platform/QDAppStore.cs

+ 17 - 4
GameClient/Assets/Game/HotUpdate/Platform/QDAppStore.cs

@@ -25,7 +25,9 @@ namespace GFGGame
     public class IAPManager : SingletonBase<IAPManager>, IStoreListener
     {
         IStoreController m_StoreController; // The Unity Purchasing system.
-        private string OrderId
+        private string OrderId;
+
+        private string OrderIdLocal
         {
             get
             {
@@ -60,15 +62,22 @@ namespace GFGGame
 
         public void CheckOrderToDo()
         {
-            if (!string.IsNullOrEmpty(this.OrderId) && !string.IsNullOrEmpty(this.TransactionId))
+            if (!string.IsNullOrEmpty(this.OrderIdLocal) && !string.IsNullOrEmpty(this.TransactionId))
             {
-                IOSRechargeSProxy.IosVerifyOrder(OrderId, this.TransactionId).Coroutine();
+                IOSRechargeSProxy.IosVerifyOrder(OrderIdLocal, this.TransactionId).Coroutine();
             }
         }
 
         public void Pay(int buyID, int count, string orderID, long Price)
         {
             Debug.Log($"Pay {buyID}");
+            if(!string.IsNullOrEmpty(this.OrderIdLocal))
+            {
+                PromptController.Instance.ShowFloatTextPrompt("有未完成的订单,请稍后再试!");
+                CheckOrderToDo();
+                return;
+
+            }
             if(!string.IsNullOrEmpty(this.OrderId))
             {
                 PromptController.Instance.ShowFloatTextPrompt("有未完成的订单,请稍后再试!");
@@ -81,6 +90,7 @@ namespace GFGGame
         public void OnServerSuccess(string OrderId, string TransactionId)
         {
             this.OrderId = null;
+            this.OrderIdLocal = null;
             this.TransactionId = null;
             PlayerPrefs.DeleteKey(OrderIdLocalkey);
             PlayerPrefs.DeleteKey(TransactionIdLocalkey);
@@ -117,6 +127,8 @@ namespace GFGGame
         public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
         {
             Debug.Log($"Purchase failed - Product: '{product.definition.id}', PurchaseFailureReason: {failureReason}");
+
+            this.OrderId = null;
         }
 
         public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
@@ -124,8 +136,9 @@ namespace GFGGame
             //Retrieve the purchased product
             var product = args.purchasedProduct;
             Debug.Log($"Purchase Complete - Product: {product.definition.id}");
+            this.OrderIdLocal = this.OrderId;
             this.TransactionId = product.transactionID;
-            IOSRechargeSProxy.IosVerifyOrder(OrderId, product.transactionID).Coroutine();
+            IOSRechargeSProxy.IosVerifyOrder(OrderIdLocal, product.transactionID).Coroutine();
 
             //We return Complete, informing IAP that the processing on our side is done and the transaction can be closed.
             return PurchaseProcessingResult.Complete;