gfg 1 年之前
父节点
当前提交
3d81e432fa

+ 3 - 1
GameClient/Assets/Game/HotUpdate/Game.HotUpdate.asmdef

@@ -7,7 +7,9 @@
         "GUID:e34a5702dd353724aa315fb8011f08c3",
         "GUID:b0a84d582f6a6fa4185f67ce934d99c2",
         "GUID:6e5063adab271564ba0098a06a8cebda",
-        "GUID:98c047f00cf7d4cbb8028bf242da48b5"
+        "GUID:98c047f00cf7d4cbb8028bf242da48b5",
+        "GUID:60bfecf5cb232594891bc622f40d6bed",
+        "GUID:08d1c582746949b40ba6a45cdb776bdf"
     ],
     "includePlatforms": [],
     "excludePlatforms": [],

+ 68 - 0
GameClient/Assets/Game/HotUpdate/Platform/QDAppStore.cs

@@ -0,0 +1,68 @@
+using UnityEngine.Purchasing;
+using UnityEngine;
+
+namespace GFGGame
+{
+    public class QDAppStore
+    {
+        public static void InitPlatform()
+        {
+            IAPManager.Instance.InitializePurchasing();
+        }
+
+        public static void Pay(int buyID, int count, string orderID, long Price)
+        {
+            IAPManager.Instance.Pay(buyID, count, orderID, Price);
+        }
+
+    }
+
+    public class IAPManager : SingletonBase<IAPManager>, IStoreListener
+    {
+        IStoreController m_StoreController; // The Unity Purchasing system.
+
+        public void Pay(int buyID, int count, string orderID, long Price)
+        {
+            Debug.Log($"Pay {buyID}");
+            m_StoreController.InitiatePurchase(buyID + "");
+        }
+
+        public void InitializePurchasing()
+        {
+            Debug.Log("InitializePurchasing");
+
+            var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
+            builder.AddProduct("10001", ProductType.Consumable);
+
+            UnityPurchasing.Initialize(this, builder);
+        }
+
+        public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
+        {
+            Debug.Log("In-App Purchasing successfully initialized");
+            m_StoreController = controller;
+            EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_INITED, true);
+        }
+
+        public void OnInitializeFailed(InitializationFailureReason error)
+        {
+            Debug.Log($"In-App Purchasing initialize failed: {error}");
+            EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_INITED, false);
+        }
+
+        public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
+        {
+            Debug.Log($"Purchase failed - Product: '{product.definition.id}', PurchaseFailureReason: {failureReason}");
+        }
+
+        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
+        {
+            //Retrieve the purchased product
+            var product = args.purchasedProduct;
+            Debug.Log($"Purchase Complete - Product: {product.definition.id}");
+
+            //We return Complete, informing IAP that the processing on our side is done and the transaction can be closed.
+            return PurchaseProcessingResult.Complete;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Platform/QDAppStore.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ba29f86a3c2294edaa395886b9409279
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 6 - 0
GameClient/Assets/Game/HotUpdate/Platform/QDManager.cs

@@ -10,6 +10,9 @@
             ViewManager.Show<ModalStatusView>("正在初始化...");
             switch (LauncherConfig.ChannelId)
             {
+                case (int)ChannelID.AppStore:
+                    QDAppStore.InitPlatform();
+                    break;
                 default:
                     EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_INITED, true);
                     break;
@@ -67,6 +70,9 @@
         {
             switch (LauncherConfig.ChannelId)
             {
+                case (int)ChannelID.AppStore:
+                    QDAppStore.Pay(buyID, count, orderID, Price);
+                    break;
                 default:
 
                     break;

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ServerProxy/IOSRechargeSProxy.cs

@@ -1,7 +1,7 @@
 using System;
 public class IOSRechargeSProxy
 {
-    public IOSRechargeSProxy()
+    public static void IosVerifyOrder()
     {
     }
 }