hexiaojie 8 сар өмнө
parent
commit
d8c3a9495f

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -307,7 +307,7 @@ namespace GFGGame
             switch (LauncherConfig.ChannelId)
             {
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.LoginOutBefore();
+                    //QDDouYouManager.Instance.LoginOutBefore();
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.LoginOutBefore();

+ 15 - 0
GameClient/Assets/Game/HotUpdate/Platform/AliPay/AliManager.cs

@@ -7,10 +7,20 @@ namespace GFGGame
 {
     public class AliManagerr : SingletonBase<AliManagerr>
     {
+        //支付宝支付
         public void Pay(string orderStr)
         {
             AliPayManagerInit.Instance.ShowSwitchPayment(orderStr);
         }
+
+        //微信支付
+        public void PayVx(string appId, string mchId, string prepayId, string packageValue,
+            string nonceStr, string timestamp, string sign, string callBackObjectName = "AliPayGameObject",
+            string callBackFuncName = "VxPayReceive")
+        {
+            AliPayManagerInit.Instance.VxShowSwitchPayment(appId, mchId, prepayId, packageValue,
+                nonceStr, timestamp, sign, callBackObjectName, callBackFuncName);
+        }
     }
 
     /// <summary>
@@ -22,5 +32,10 @@ namespace GFGGame
         {
             Debug.Log("Game.HotUpdate AliPayReceiveAb: " + message);
         }
+
+        public void VxPayReceiveAb(string message)
+        {
+            Debug.Log("Game.HotUpdate VxPayReceiveAb: " + message);
+        }
     }
 }

+ 30 - 27
GameClient/Assets/Game/HotUpdate/Platform/QDManager.cs

@@ -17,7 +17,7 @@ namespace GFGGame
                     QDShareManager.Instance.Init();
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.Init();
+                    //QDDouYouManager.Instance.Init();
                     QDShareManager.Instance.Init();
                     break;
                 case (int)ChannelID.DouYouDev:
@@ -49,7 +49,12 @@ namespace GFGGame
 
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.Login();
+                    bool loginDouYou = GameController.CheckLoginCache(true);
+                    if (!loginDouYou)
+                    {
+                        ViewManager.Hide<ModalStatusView>();
+                        ViewManager.Show<LoginInputView>();
+                    }
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.Login();
@@ -70,7 +75,7 @@ namespace GFGGame
 
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.OnCreateRole();
+                 
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.OnCreateRole();
@@ -88,7 +93,7 @@ namespace GFGGame
 
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.OnEnterGame();
+               
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.OnEnterGame();
@@ -110,7 +115,7 @@ namespace GFGGame
 
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.OnQuitToLoginView();
+                
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.OnQuitToLoginView();
@@ -131,7 +136,6 @@ namespace GFGGame
 
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.Pay(buyID, count, orderID, price);
                     //TODO gfg支付跳转
                     ViewManager.Show<StorePayPropView>(new object[] { buyID, orderID, price });
                     break;
@@ -162,7 +166,6 @@ namespace GFGGame
 
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.Logout();
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.Logout();
@@ -183,7 +186,7 @@ namespace GFGGame
                     GameController.ShowExitAlert();
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.Exit();
+                    GameController.ShowExitAlert();
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.Exit();
@@ -206,25 +209,25 @@ namespace GFGGame
                     break;
                 case (int)ChannelID.DouYou:
                     //改名上报给sdk
-                    var zoneScene = GameGlobal.zoneScene;
-                    if (zoneScene == null) return;
-
-                    if (zoneScene.GetComponent<RoleInfosComponent>() == null ||
-                        zoneScene.GetComponent<RoleInfosComponent>().IsDisposed) return;
-
-                    var roleInfo = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRole();
-                    if (roleInfo == null) return;
-
-                    if (GameGlobal.myNumericComponent == null) return;
-                    int lvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
-
-                    if (zoneScene.GetComponent<ServerInfosComponent>() == null) return;
-                    if (zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
-
-                    string serverName = zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
-                    QDDouYouManagerInit.Instance.ReportRole((int)reportType,
-                        roleInfo.Id.ToString(), lvl.ToString(), roleInfo.Name, roleInfo.ServerId.ToString(),
-                        serverName);
+                    // var zoneScene = GameGlobal.zoneScene;
+                    // if (zoneScene == null) return;
+                    //
+                    // if (zoneScene.GetComponent<RoleInfosComponent>() == null ||
+                    //     zoneScene.GetComponent<RoleInfosComponent>().IsDisposed) return;
+                    //
+                    // var roleInfo = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRole();
+                    // if (roleInfo == null) return;
+                    //
+                    // if (GameGlobal.myNumericComponent == null) return;
+                    // int lvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+                    //
+                    // if (zoneScene.GetComponent<ServerInfosComponent>() == null) return;
+                    // if (zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
+                    //
+                    // string serverName = zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
+                    // QDDouYouManagerInit.Instance.ReportRole((int)reportType,
+                    //     roleInfo.Id.ToString(), lvl.ToString(), roleInfo.Name, roleInfo.ServerId.ToString(),
+                    //     serverName);
                     break;
                 case (int)ChannelID.DouYouDev:
                     //改名上报给sdk

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -206,7 +206,7 @@ namespace GFGGame
 
                     break;
                 case (int)ChannelID.DouYou:
-                    QDDouYouManager.Instance.LoginOutBefore();
+                    // QDDouYouManager.Instance.LoginOutBefore();
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManager.Instance.LoginOutBefore();

+ 17 - 7
GameClient/Assets/Game/HotUpdate/Views/Store/StorePayPropView.cs

@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
 using ET;
 using FairyGUI;
 using UI.Store;
@@ -53,8 +54,8 @@ namespace GFGGame
         {
             base.OnShown();
             _goodsId = (int)(this.viewData as object[])[0];
-            _tempOrderId = (int)(this.viewData as object[])[1];
-            _price = (int)(this.viewData as object[])[2];
+            _tempOrderId = long.Parse((this.viewData as object[])[1].ToString());
+            _price = (long)(this.viewData as object[])[2];
             ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
             _ui.m_txtTotal.text = _price + "元";
             _ui.m_txtShopName.text = cfg.productName;
@@ -63,6 +64,19 @@ namespace GFGGame
 
         private async void OnVxBtnBuyClick()
         {
+            string timestamp = ((long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds).ToString();
+            string APP_ID = "wxd9772f42f126413f";
+            string MCH_ID = "200768907612";
+            string prepayid = "wx201411101639507cbf6ffd8b0779950874";
+            string packageValue = "Sign=WXPay";
+            string noncestr = "5K8264ILTKCH16CQ2502SI8ZNMI4POJ5";
+            string sign = "C380BEC2BFD727A4B6845133519F3AD6";
+            AliManagerr.Instance.PayVx(APP_ID, MCH_ID, prepayid, packageValue,
+                noncestr, timestamp, sign);
+        }
+
+        private async void OnAliBtnBuyClick()
+        {
             S2C_CreateAliOrder response = await ShopSProxy.ReqCreateAliOrder(_tempOrderId);
             if (response == null || string.IsNullOrEmpty(response.AliOrderStr))
             {
@@ -73,10 +87,6 @@ namespace GFGGame
             AliManagerr.Instance.Pay(response.AliOrderStr);
         }
 
-        private async void OnAliBtnBuyClick()
-        {
-        }
-
         private async void OnCloseClick()
         {
         }

+ 2 - 1
GameClient/Assets/Game/Launcher/LauncherConfig.cs

@@ -66,6 +66,7 @@ namespace GFGGame
         public static string gameId;
 
         public static string douYouAdId;
+        public static string vxSdkAppId = "wxd9772f42f126413f";
 
         //是否使用douYou的ios sdk 0不使用用douYouSdk 1使用douYouSdk
         public static string isUseDouYouIos;
@@ -88,7 +89,7 @@ namespace GFGGame
             ChannelId = (int)ChannelID.TapTap;
 #elif PT_DOUYOU
             netType = EnumNetType.PUBLIC;
-            cfgName = "cfg_douYou";
+            cfgName = "cfg_gfg";
             ChannelId = (int)ChannelID.DouYou;
 #elif PT_IOS
             netType = EnumNetType.PUBLIC;

+ 38 - 3
GameClient/Assets/Game/Launcher/Platform/Pay/AliPayManagerInit.cs

@@ -7,7 +7,7 @@ namespace GFGGame.Launcher
     public class AliPayManagerInit : SingletonBase<AliPayManagerInit>
     {
         public IAliSDKListener aliSDKListener;
-        
+
         private static AndroidJavaClass _unityPlayerClass;
 
         private static AndroidJavaObject _mainActivity;
@@ -31,16 +31,45 @@ namespace GFGGame.Launcher
                 gameObject.AddComponent<AliDKHandler>();
                 GameObject.DontDestroyOnLoad(gameObject);
             }
+
+            InitVxSdk(LauncherConfig.vxSdkAppId);
         }
 
         /// <summary>
-        /// 调起支付
+        /// 调起支付宝支付
         /// </summary>
-        public void ShowSwitchPayment(string orderStr, string callBackObjectName = "AliPayGameObject", string callBackFuncName = "AliPayReceive")
+        public void ShowSwitchPayment(string orderStr, string callBackObjectName = "AliPayGameObject",
+            string callBackFuncName = "AliPayReceive")
         {
             Instance.CallDouYouMainActivity("AliPay", orderStr, callBackObjectName, callBackFuncName);
         }
 
+        //实例化微信SDK
+        public void InitVxSdk(string appId)
+        {
+            Instance.CallDouYouMainActivity("WechatInit", appId);
+        }
+
+        /// <summary>
+        /// 调起微信支付
+        /// </summary>
+        /// <param name="appId">APP_ID:微信开放平台应用的唯一标识,通常由微信支付平台提供。</param>
+        /// <param name="mchId">MCH_ID:商户号,由微信支付平台提供。</param>
+        /// <param name="prepayId">prepayid:通过调用统一下单接口得到的预支付交易会话ID。是微信支付在后台创建订单时返回的参数。</param>
+        /// <param name="packageValue">packageValue:签名方式,通常为 "Sign=WXPay",如果需要做其他支付方式,可以修改这个值。</param>
+        /// <param name="nonceStr">packageValue:签名方式,通常为 "Sign=WXPay",如果需要做其他支付方式,可以修改这个值。</param>
+        /// <param name="timestamp">timestamp:时间戳,当前时间的秒级表示。这个值在每次请求时需要实时获取。</param>
+        /// <param name="sign">sign:签名,必须按照微信支付要求的方式来计算签名。签名的计算规则涉及到其他参数,需要商户自己计算。</param>
+        /// <param name="callBackObjectName"></param>
+        /// <param name="callBackFuncName"></param>
+        public void VxShowSwitchPayment(string appId, string mchId, string prepayId, string packageValue,
+            string nonceStr, string timestamp, string sign, string callBackObjectName = "AliPayGameObject",
+            string callBackFuncName = "VxPayReceive")
+        {
+            Instance.CallDouYouMainActivity("WeChatPayReq", appId, mchId, prepayId, packageValue,
+                nonceStr, timestamp, sign, callBackObjectName, callBackFuncName);
+        }
+
         private void CallDouYouMainActivity(string functionName, params object[] args)
         {
             _mainActivity?.Call(functionName, args);
@@ -57,6 +86,12 @@ namespace GFGGame.Launcher
                 Debug.Log($"AliPayReceiveAb:{message}");
                 AliPayManagerInit.Instance.aliSDKListener?.AliPayReceiveAb(message);
             }
+
+            public override void VxPayReceiveAb(string message)
+            {
+                Debug.Log($"AliPayReceiveAb:{message}");
+                AliPayManagerInit.Instance.aliSDKListener?.VxPayReceiveAb(message);
+            }
         }
     }
 }

+ 2 - 0
GameClient/Assets/Game/Launcher/Platform/Pay/IAliSDKListener.cs

@@ -3,5 +3,7 @@
     public interface IAliSDKListener
     {
         public void AliPayReceiveAb(string message);
+
+        public void VxPayReceiveAb(string message);
     }
 }

+ 5 - 2
GameClient/Assets/Game/Launcher/Platform/QDManagerInit.cs

@@ -10,8 +10,11 @@ namespace GFGGame.Launcher
             switch (LauncherConfig.ChannelId)
             {
                 case (int)ChannelID.DouYou:
-                    QDDouYouManagerInit.Instance.InitSDK(LauncherConfig.douYouAdId);
-                    QDShareManagerInit.Instance.InitSDK();
+                    //QDDouYouManagerInit.Instance.InitSDK(LauncherConfig.douYouAdId);
+                    //QDShareManagerInit.Instance.InitSDK();
+                    UniEvent.SendMessage(new LauncherEvent.InitPlatformResult() { success = true });
+                    AliPayManagerInit.Instance.InitSDK();
+        
                     break;
                 case (int)ChannelID.DouYouDev:
                     QDDouYouManagerInit.Instance.InitSDK(LauncherConfig.douYouAdId);

+ 12 - 0
GameClient/Assets/ThirdParty/AliPay/AliPaySDKHandler.cs

@@ -6,6 +6,8 @@ namespace DouYouSdk
     {
         public abstract void AliPayReceiveAb(string message);
         
+        public abstract void VxPayReceiveAb(string message);
+        
         /// <summary>
         /// 
         /// </summary>
@@ -15,5 +17,15 @@ namespace DouYouSdk
             Debug.Log($"AliPayReceive:{message}");
             AliPayReceiveAb(message);
         }
+        
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="message"></param>
+        public void VxPayReceive(string message)
+        {
+            Debug.Log($"VxPayReceive:{message}");
+            VxPayReceiveAb(message);
+        }
     }
 }