Forráskód Böngészése

Merge remote-tracking branch 'remotes/origin/master' into GFG

# Conflicts:
#	GameClient/Assets/Game/Launcher/Platform/QDManagerInit.cs
hexiaojie 8 hónapja
szülő
commit
dd566f0554

+ 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

+ 8 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ShopSProxy.cs

@@ -229,5 +229,13 @@ namespace GFGGame
                 { OrderTempId = tempOrderId });
             return response;
         }
+        
+        //创建微信订单
+        public static async ETTask<S2C_CreateWeChatPayOrder> ReqCreateWeChatOrder(long tempOrderId)
+        {
+            var response = (S2C_CreateWeChatPayOrder)await MessageHelper.SendToServer(new C2S_CreateWeChatPayOrder()
+                { OrderTempId = tempOrderId });
+            return response;
+        }
     }
 }

+ 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();

+ 22 - 6
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,18 +64,33 @@ namespace GFGGame
 
         private async void OnVxBtnBuyClick()
         {
-            S2C_CreateAliOrder response = await ShopSProxy.ReqCreateAliOrder(_tempOrderId);
-            if (response == null || string.IsNullOrEmpty(response.AliOrderStr))
+            S2C_CreateWeChatPayOrder response = await ShopSProxy.ReqCreateWeChatOrder(_tempOrderId);
+            if (response == null || response.Error != ErrorCode.ERR_Success)
             {
                 //TODO 提示调起支付宝失败
                 return;
             }
 
-            AliManagerr.Instance.Pay(response.AliOrderStr);
+            string APP_ID = "wxd9772f42f126413f";
+            string MCH_ID = "200768907612";
+            string prepayid = response.PrepayIdStr;
+            string packageValue = "Sign=WXPay";
+            string noncestr = response.NonceStr;
+            string sign = response.Sign;
+            AliManagerr.Instance.PayVx(APP_ID, MCH_ID, prepayid, packageValue,
+                noncestr, response.Timestamp, sign);
         }
 
         private async void OnAliBtnBuyClick()
         {
+            S2C_CreateAliOrder response = await ShopSProxy.ReqCreateAliOrder(_tempOrderId);
+            if (response == null || response.Error != ErrorCode.ERR_Success)
+            {
+                //TODO 提示调起支付宝失败
+                return;
+            }
+
+            AliManagerr.Instance.Pay(response.AliOrderStr);
         }
 
         private async void OnCloseClick()

+ 1 - 0
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;

+ 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">这是一个随机字符串,用于防止请求被重放。</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);
     }
 }

+ 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);
+        }
     }
 }

+ 1 - 1
GameClient/GameClient.sln.DotSettings.user

@@ -1,3 +1,3 @@
 <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEditorUtility_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8d4895b259be41298a685a0c9b42357576b400_003F3f_003Fa805acc1_003FEditorUtility_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
-	<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String></wpf:ResourceDictionary>
+	</wpf:ResourceDictionary>