hexiaojie 7 месяцев назад
Родитель
Сommit
c8a7492c72

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -20,7 +20,7 @@ namespace GFGGame
         {
             ViewManager.Show<ModalStatusView>("");
             (int errorCode, long deleteTime) =
-                await ET.LoginHelper.H5Login(GameGlobal.zoneScene, GameConfig.LoginAddress);
+                await ET.LoginHelper.H5Login(GameGlobal.zoneScene, GameConfig.LoginAddress, null);
 
             if (errorCode == ET.ErrorCode.ERR_Success)
             {
@@ -30,7 +30,7 @@ namespace GFGGame
                 AccountInfoComponent accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
                 GameGlobal.userId = accountInfoComponent.AccountId;
                 GameGlobal.userAge = accountInfoComponent.Age;
-                
+
                 GameController.CheckSpecialAccount("sygfg");
                 LocalCache.SetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, GameGlobal.isVisitor);
                 PlayerPrefs.Save();

+ 2 - 0
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Account/A2C_DisconnectHandler.cs

@@ -1,4 +1,5 @@
 using GFGGame;
+using GFGGame.Launcher;
 using UnityEngine;
 
 namespace ET
@@ -19,6 +20,7 @@ namespace ET
                         });
                     break;
                 case ErrorCode.ERR_loginByOther:
+                    QDJHGameManagerInit.Instance.RepeatLogin();
                     AlertSystem.Show("账号已在其他地方登录!")
                         .SetLeftButton(true, "返回登录", (obj) =>
                         {

+ 2 - 2
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Login/LoginHelper.cs

@@ -6,7 +6,7 @@ namespace ET
 {
     public static class LoginHelper
     {
-        public static async ETTask<(int, long)> H5Login(Scene zoneScene, string address)
+        public static async ETTask<(int, long)> H5Login(Scene zoneScene, string address, Action<int> callback)
         {
             A2C_LoginAccount a2CLoginAccount = null;
             Session accountSession = null;
@@ -42,7 +42,7 @@ namespace ET
             }
 
             OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession, QDJGameManager.Instance.UserId);
-
+            callback?.Invoke(a2CLoginAccount.Error);
             return (ErrorCode.ERR_Success, 0);
         }
 

+ 1 - 2
GameClient/Assets/Game/HotUpdate/HotUpdateDriver.cs

@@ -47,8 +47,7 @@ namespace GFGGame
                 QDManager.Exit();
             }
         }
-
-
+        
         private void OnApplicationPause(bool pause)
         {
             if(pause)

+ 90 - 52
GameClient/Assets/Game/HotUpdate/Platform/QDJGameManager.cs

@@ -35,65 +35,105 @@ namespace GFGGame
             CpExt = sdkParams["cp_ext"].ToString();
         }
 
-        public void Login()
-        {
-            // if (!string.IsNullOrEmpty(uid))
-            // {
-            //     EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_LOGINED, uid);
-            //     return;
-            // }
-            // if (isLogining) return;
-            // Debug.Log($"quick Login");
-            // isLogining = true;
-            QDJHGameManagerInit.Instance.ShowLogin();
-        }
-
         public void OnCreateRole()
         {
-            QDManager.PushRoleAction(DouYouRoleLogReportType.CreateRole);
+            //改名上报给sdk
+            var zoneSceneDev = GameGlobal.zoneScene;
+            if (zoneSceneDev == null) return;
+
+            if (zoneSceneDev.GetComponent<RoleInfosComponent>() == null ||
+                zoneSceneDev.GetComponent<RoleInfosComponent>().IsDisposed) return;
+
+            var roleInfoDev = zoneSceneDev.GetComponent<RoleInfosComponent>().GetCurrentRole();
+            if (roleInfoDev == null) return;
+
+            if (GameGlobal.myNumericComponent == null) return;
+            int lvlDev = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+            int vipLvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+
+            if (zoneSceneDev.GetComponent<ServerInfosComponent>() == null) return;
+            if (zoneSceneDev.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
+            long itemNum = ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE);
+
+            string serverNameDev =
+                zoneSceneDev.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
+            QDJHGameManagerInit.Instance.CreateRole(roleInfoDev.Id.ToString(),
+                roleInfoDev.Name,
+                lvlDev,
+                zoneSceneDev.GetComponent<ServerInfosComponent>().CurrentServerId.ToString(),
+                serverNameDev,
+                vipLvl,
+                "",
+                itemNum.ToString(),
+                roleInfoDev.CreateTime.ToString());
         }
 
         public void OnEnterGame()
         {
-            var zoneScene = GameGlobal.zoneScene;
-            if (zoneScene == null) return;
+            var zoneSceneDev = GameGlobal.zoneScene;
+            if (zoneSceneDev == null) return;
 
-            if (zoneScene.GetComponent<RoleInfosComponent>() == null ||
-                zoneScene.GetComponent<RoleInfosComponent>().IsDisposed) return;
+            if (zoneSceneDev.GetComponent<RoleInfosComponent>() == null ||
+                zoneSceneDev.GetComponent<RoleInfosComponent>().IsDisposed) return;
 
-            var roleInfo = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRole();
-            if (roleInfo == null) return;
+            var roleInfoDev = zoneSceneDev.GetComponent<RoleInfosComponent>().GetCurrentRole();
+            if (roleInfoDev == 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;
-
-            QDJHGameManagerInit.Instance.ReportRoleLogin(roleInfo.Id.ToString(), lvl.ToString(), roleInfo.Name,
-                roleInfo.ServerId.ToString(), serverName);
-            QDManager.PushRoleAction(DouYouRoleLogReportType.EnterGame);
+            int lvlDev = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+            int vipLvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+
+            if (zoneSceneDev.GetComponent<ServerInfosComponent>() == null) return;
+            if (zoneSceneDev.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
+            long itemNum = ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE);
+
+            string serverNameDev =
+                zoneSceneDev.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
+            QDJHGameManagerInit.Instance.LoginRole(roleInfoDev.Id.ToString(),
+                roleInfoDev.Name,
+                lvlDev,
+                zoneSceneDev.GetComponent<ServerInfosComponent>().CurrentServerId.ToString(),
+                serverNameDev,
+                vipLvl,
+                "",
+                itemNum.ToString(),
+                roleInfoDev.CreateTime.ToString());
         }
 
-        public void OnQuitToLoginView()
+        public void UpgradeRole()
         {
-            Debug.Log($"DouYou OnQuitToLoginView");
-        }
+            var zoneSceneDev = GameGlobal.zoneScene;
+            if (zoneSceneDev == null) return;
 
-        public void Logout()
-        {
-            Debug.Log($"Game.HotUpdate DouYou Logout");
-            QDJHGameManagerInit.Instance.ShowLogout();
-        }
+            if (zoneSceneDev.GetComponent<RoleInfosComponent>() == null ||
+                zoneSceneDev.GetComponent<RoleInfosComponent>().IsDisposed) return;
 
-        public void LoginOutBefore()
-        {
-            QDManager.PushRoleAction(DouYouRoleLogReportType.ExitGame);
+            var roleInfoDev = zoneSceneDev.GetComponent<RoleInfosComponent>().GetCurrentRole();
+            if (roleInfoDev == null) return;
+
+            if (GameGlobal.myNumericComponent == null) return;
+            int lvlDev = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+            int vipLvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+
+            if (zoneSceneDev.GetComponent<ServerInfosComponent>() == null) return;
+            if (zoneSceneDev.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
+            long itemNum = ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE);
+
+            string serverNameDev =
+                zoneSceneDev.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
+            QDJHGameManagerInit.Instance.UpgradeRole(roleInfoDev.Id.ToString(),
+                roleInfoDev.Name,
+                lvlDev,
+                zoneSceneDev.GetComponent<ServerInfosComponent>().CurrentServerId.ToString(),
+                serverNameDev,
+                vipLvl,
+                "",
+                itemNum.ToString(),
+                roleInfoDev.CreateTime.ToString());
         }
 
-        public void Pay(int buyID, int count, string orderID, long price)
+
+        public void Pay(int buyID, string orderID, long price)
         {
             ShopCfg shopCfg = CommonDataManager.Tables.TblShopCfg.GetOrDefault(buyID);
             if (shopCfg == null)
@@ -121,24 +161,20 @@ namespace GFGGame
 
             if (GameGlobal.myNumericComponent == null) return;
             int lvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
+            int vipLevel = GameGlobal.myNumericComponent.GetAsInt(NumericType.VipLevel);
 
             if (zoneScene.GetComponent<ServerInfosComponent>() == null) return;
             if (zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
 
             string serverName = zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
-
+            long itemNum = ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE);
 
             //自定义参数
             string other = orderID + "|gfg|" + roleInfo.Id;
-            QDJHGameManagerInit.Instance.ShowSwitchPayment(orderID, price.ToString(), buyID.ToString(),
-                shopCfg.ItemName, string.Empty,
-                roleInfo.ServerId.ToString(), serverName, roleInfo.Id.ToString(), roleInfo.Name, lvl.ToString(), other);
-        }
-
-        public void Exit()
-        {
-            QDManager.PushRoleAction(DouYouRoleLogReportType.ExitGame);
-            QDDouYouManagerInit.Instance.ExitApp();
+            QDJHGameManagerInit.Instance.Recharge(Convert.ToInt32(price * 1000), buyID.ToString(), shopCfg.ItemName,
+                LauncherConfig.rechargeAddress,
+                roleInfo.ServerId.ToString(), serverName, roleInfo.Name, roleInfo.Id.ToString(), lvl.ToString(),
+                vipLevel.ToString(), orderID, itemNum.ToString(), other, "");
         }
     }
 
@@ -155,11 +191,13 @@ namespace GFGGame
         //支付完成后通知Unity
         public void OnRechargeCompleteAb(string message)
         {
+            Debug.Log("Game.HotUpdate OnRechargeCompleteAb" + message);
         }
 
         //支付错误
         public void OnRechargeErrorAb(string message)
         {
+            Debug.Log("Game.HotUpdate PayFailAb: " + message);
         }
 
         //创建角色实例化完成

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

@@ -44,7 +44,10 @@ namespace GFGGame
             switch (LauncherConfig.ChannelId)
             {
                 case (int)ChannelID.Test:
-
+                    QDJGameManager.Instance.OnCreateRole();
+                    break;
+                case (int)ChannelID.H5:
+                    QDJGameManager.Instance.OnCreateRole();
                     break;
                 default:
                     break;
@@ -56,7 +59,25 @@ namespace GFGGame
             switch (LauncherConfig.ChannelId)
             {
                 case (int)ChannelID.Test:
+                    QDJGameManager.Instance.OnEnterGame();
+                    break;
+                case (int)ChannelID.H5:
+                    QDJGameManager.Instance.OnEnterGame();
+                    break;
+                default:
+                    break;
+            }
+        }
 
+        public static void OnUpgradeRole()
+        {
+            switch (LauncherConfig.ChannelId)
+            {
+                case (int)ChannelID.Test:
+                    QDJGameManager.Instance.UpgradeRole();
+                    break;
+                case (int)ChannelID.H5:
+                    QDJGameManager.Instance.UpgradeRole();
                     break;
                 default:
                     break;
@@ -81,7 +102,10 @@ namespace GFGGame
             switch (LauncherConfig.ChannelId)
             {
                 case (int)ChannelID.Test:
-
+                    QDJGameManager.Instance.Pay(buyID, orderID, price);
+                    break;
+                case (int)ChannelID.H5:
+                    QDJGameManager.Instance.Pay(buyID, orderID, price);
                     break;
                 default:
                     break;
@@ -119,11 +143,10 @@ namespace GFGGame
                     break;
             }
         }
-        
+
         public static bool IsTaptap
         {
             get { return LauncherConfig.ChannelId == 101; }
         }
-        
     }
 }

+ 8 - 5
GameClient/Assets/Game/HotUpdate/ServerProxy/CommonSProxy.cs

@@ -8,7 +8,7 @@ namespace ET
     {
         protected override async ETTask Run(Session session, M2C_NoticeUnitNumeric message)
         {
-            if (GameGlobal.myNumericComponent == null) return;//如果为空表示角色还没有进入游戏,忽略
+            if (GameGlobal.myNumericComponent == null) return; //如果为空表示角色还没有进入游戏,忽略
             var oldValue = GameGlobal.myNumericComponent.GetAsInt(message.NumericType);
             GameGlobal.myNumericComponent.Set(message.NumericType, message.NewValue);
 
@@ -18,6 +18,7 @@ namespace ET
                     FunctionOpenDataManager.Instance.CheckHasLvFunOpen((int)message.NewValue,
                         oldValue); //等级变化要加测是否有功能开启
                     RoleDataManager.RoleLvUp(oldValue);
+                    QDManager.OnUpgradeRole();
                     break;
                 case NumericType.Power:
                     RoleDataManager.powerTimeServerLock = false;
@@ -30,6 +31,7 @@ namespace ET
                     EventAgent.DispatchEvent(ConstMessage.BATTLEPASS_LEVEL_CHANGE);
                     break;
             }
+
             EventAgent.DispatchEvent(ConstMessage.NUMERIC_CHANGE, message.NumericType);
             EventAgent.DispatchEvent(ConstMessage.RED_CHANGE, message.NumericType);
             await ETTask.CompletedTask;
@@ -39,7 +41,6 @@ namespace ET
 
 namespace GFGGame
 {
-
     public static class CommonSProxy
     {
         //客户端请求每日重置
@@ -73,12 +74,14 @@ namespace GFGGame
                     await ActivityGetYuanXiaoProxy.ReqGetActivityGameInfos();
                     await ActivityFYJYProxy.ReqGetActivityGameInfos();
                     await MatchingCompetitionSproxy.ReqMatchingCompetitionInfo();
-                    ActivityDataManager.Instance.todayActivityTips = GameGlobal.myNumericComponent.GetAsInt(NumericType.IsPropYchmActivity);
-                    ActivityDataManager.Instance.todayMonthlyCardTips = GameGlobal.myNumericComponent.GetAsInt(NumericType.IsPropCzykActivity);
+                    ActivityDataManager.Instance.todayActivityTips =
+                        GameGlobal.myNumericComponent.GetAsInt(NumericType.IsPropYchmActivity);
+                    ActivityDataManager.Instance.todayMonthlyCardTips =
+                        GameGlobal.myNumericComponent.GetAsInt(NumericType.IsPropCzykActivity);
                     EventAgent.DispatchEvent(ConstMessage.RESET_DAILY_DATA);
                     PromptController.Instance.ShowFloatTextPrompt("每日次数已重置", MessageType.SUCCESS);
                 }
             }
         }
     }
-}
+}

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

@@ -67,7 +67,8 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            _ui.m_btnStart.visible = true;
+            _ui.m_btnStart.visible = false;
+            _ui.m_btnStart.text = "登录中...";
             MusicManager.Instance.PlayCroutine(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
             if (_sceneObject == null)
             {
@@ -96,8 +97,6 @@ namespace GFGGame
 
         private void ContinueAfterSceneLoad()
         {
-            Debug.Log($"ShowLogin ContinueAfterSceneLoad");
-            // SceneController.UpdateLoginScene(_sceneObject);
             ServerInfosComponent serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
             ServerInfo recentlyServerInfo = serverInfosComponent.recentlyServerInfo;
             UpdateServer(recentlyServerInfo);
@@ -113,6 +112,7 @@ namespace GFGGame
                     minuteText = date.Minute + "分";
                 }
 
+                _ui.m_btnStart.text = "";
                 AlertUI.Show($"    亲爱的研究员,万世镜将于{date.Year}年{date.Month}月{date.Day}日{date.Hour}点{minuteText}开放,敬请期待!")
                     .SetLeftButton(true, "好的", (obj) => { Application.Quit(); });
                 return;
@@ -186,7 +186,7 @@ namespace GFGGame
 
         private void OnClickBtnStart()
         {
-            TryLogin();
+            LoginController.GetRoles().Coroutine();
         }
 
         private void OnClickBtnAge()
@@ -199,13 +199,14 @@ namespace GFGGame
         {
             var url = LauncherConfig.cfgUrl.Replace("{cfgName}", LauncherConfig.cfgName);
             url = url + "?t=" + DateTime.Now.Ticks;
-            HttpTool.Instance.Get(url, (string json) =>
+            HttpTool.Instance.Get(url, json =>
             {
                 LauncherConfig.InitPlatform(json);
                 if (LauncherConfig.serverStatus == 1)
                 {
                     if (string.IsNullOrEmpty(LauncherConfig.statusPrompt))
                     {
+                        _ui.m_btnStart.text = "维护中";
                         LauncherConfig.statusPrompt = "游戏正在更新维护中,请稍后再试。";
                     }
 
@@ -220,8 +221,12 @@ namespace GFGGame
                     return;
                 }
 
-                LoginHelper.H5Login();
-                LoginController.GetRoles().Coroutine();
+                LoginHelper.H5Login(GameGlobal.zoneScene, GameConfig.LoginAddress,
+                    error =>
+                    {
+                        _ui.m_btnStart.visible = true;
+                        _ui.m_btnStart.text = "开始游戏";
+                    }).Coroutine();
             });
         }
 

+ 9 - 0
GameClient/Assets/Game/Launcher/LauncherConfig.cs

@@ -73,6 +73,8 @@ namespace GFGGame
 
         public static bool isHttps;
 
+        public static string rechargeAddress;
+
         public static void InitScriptCompilation()
         {
             launcherRootUrl = "https://cdn.goufuguiwxw.com/";
@@ -145,6 +147,11 @@ namespace GFGGame
                 LauncherConfig.douYouAdId = result.douYouAdId;
             }
 
+            if (!string.IsNullOrEmpty(result.rechargeAddress))
+            {
+                LauncherConfig.rechargeAddress = result.rechargeAddress;
+            }
+
             LauncherConfig.manifest_v = result.manifest_v;
             LauncherConfig.privacy_v = result.privacy_v;
             LauncherConfig.statusPrompt = result.statusPrompt;
@@ -188,6 +195,8 @@ namespace GFGGame
             public string isUseDouYouIos;
 
             public string isHttps;
+
+            public string rechargeAddress;
         }
     }
 }

+ 33 - 5
GameClient/Assets/Game/Launcher/Platform/QDJHGameManagerInit.cs

@@ -51,9 +51,25 @@ namespace GFGGame.Launcher
             // 调用JS函数
             Application.ExternalCall(functionName, jsonParams);
         }
-        
-        // 支付相关
-        public void Recharge(int amount, string productName, string notifyUrl, string serverId,
+
+        /// <summary>
+        /// 支付相关
+        /// </summary>
+        /// <param name="amount">充值金额 单位为分</param>
+        /// <param name="cpProductId">商品 ID</param>
+        /// <param name="productName">游戏货币名(如元宝,金币)</param>
+        /// <param name="notifyUrl">充值回调地址</param>
+        /// <param name="serverId">用户角色所在服 id</param>
+        /// <param name="serverName">用户角色所在服务器名</param>
+        /// <param name="roleName">角色名字</param>
+        /// <param name="roleId">角色 id</param>
+        /// <param name="roleLevel">角色等级</param>
+        /// <param name="vipLevel">Vip 等级</param>
+        /// <param name="cpOrderId">研发订单号</param>
+        /// <param name="balance">玩家余额</param>
+        /// <param name="extra">透传参数字段(原样返回)</param>
+        /// <param name="fighting">战力</param>
+        public void Recharge(int amount, string cpProductId, string productName, string notifyUrl, string serverId,
             string serverName, string roleName, string roleId, string roleLevel,
             string vipLevel, string cpOrderId, string balance, string extra = "",
             string fighting = "")
@@ -62,6 +78,7 @@ namespace GFGGame.Launcher
             var parameters = new Dictionary<string, object>
             {
                 { "amount", amount },
+                { "cpProductId", cpProductId },
                 { "productName", productName },
                 { "notifyUrl", notifyUrl },
                 { "serverId", serverId },
@@ -80,7 +97,18 @@ namespace GFGGame.Launcher
             CallJSFunction("JHRecharge", parameters);
         }
 
-        // 创建角色
+        /// <summary>
+        /// 创建角色
+        /// </summary>
+        /// <param name="roleId">角色 id</param>
+        /// <param name="roleName">角色名</param>
+        /// <param name="roleLevel">角色等级</param>
+        /// <param name="serverId">角色所在服 id</param>
+        /// <param name="serverName">角色所在服名</param>
+        /// <param name="vipLevel">角色 vip 等级</param>
+        /// <param name="fighting">战力值 (若无传””)</param>
+        /// <param name="balance">玩家余额</param>
+        /// <param name="roleCTime">创角时间</param>
         public void CreateRole(string roleId, string roleName, int roleLevel, string serverId,
             string serverName, int vipLevel, string fighting, string balance,
             string roleCTime = "")
@@ -162,7 +190,7 @@ namespace GFGGame.Launcher
             // 调用JS的JHCallIcpBeian函数
             CallJSFunction("JHCallIcpBeian", new Dictionary<string, object>());
         }
-        
+
         public class JHGameSDKHandler : AbJHGameSDKHandler
         {
             /// <summary>