From 04a5a0e048b3b01d9b0347cc6c7fbfbe1268810e Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Fri, 14 Jul 2023 14:23:51 +0800 Subject: [PATCH] Update Demo Update Demo --- .../HotFix/GameLogic/DataCenter/NetworkUtils.cs | 8 +++++++- .../HotFix/GameLogic/NetWorkDemo/PlayerNetSys.cs | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Assets/GameScripts/HotFix/GameLogic/DataCenter/NetworkUtils.cs b/Assets/GameScripts/HotFix/GameLogic/DataCenter/NetworkUtils.cs index d378fcea..7d48efaf 100644 --- a/Assets/GameScripts/HotFix/GameLogic/DataCenter/NetworkUtils.cs +++ b/Assets/GameScripts/HotFix/GameLogic/DataCenter/NetworkUtils.cs @@ -4,12 +4,18 @@ namespace GameLogic { public class NetworkUtils { + /// + /// 网络消息校验错误码。 + /// + /// 网络回复消息包。 + /// 是否存在错误。 public static bool CheckError(IResponse response) { bool hasError = false; if (response == null) { - var networkError = "NetWork Response Error"; + // TODO 根据错误码Tips提示。 + // var networkError = "NetWork Response Error"; hasError = true; } else diff --git a/Assets/GameScripts/HotFix/GameLogic/NetWorkDemo/PlayerNetSys.cs b/Assets/GameScripts/HotFix/GameLogic/NetWorkDemo/PlayerNetSys.cs index 5f259d14..fa508627 100644 --- a/Assets/GameScripts/HotFix/GameLogic/NetWorkDemo/PlayerNetSys.cs +++ b/Assets/GameScripts/HotFix/GameLogic/NetWorkDemo/PlayerNetSys.cs @@ -10,12 +10,20 @@ namespace GameLogic /// public class PlayerNetSys:DataCenterModule { + /// + /// 网络模块初始化。 + /// public override void Init() { base.Init(); + //注册登录消息回调。 GameClient.Instance.RegisterMsgHandler(OuterOpcode.H_G2C_LoginResponse,OnLoginRes); } + /// + /// 登录消息回调。 + /// + /// 网络回复消息包。 public void OnLoginRes(IResponse response) { if (NetworkUtils.CheckError(response)) @@ -28,6 +36,11 @@ namespace GameLogic GameClient.Instance.Status = GameClientStatus.StatusEnter; } + /// + /// 登录消息请求。 + /// + /// 用户名。 + /// 用户密码。 public void DoLoginReq(string userName,string passWord) { if (GameClient.Instance.Status == GameClientStatus.StatusEnter)