From d567cd9e7123de5343fa1174468f15f59fe35ee3 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Fri, 13 Sep 2024 10:10:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AF=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Server/Manager/AppSrv.cs | 1 - .../Manager/LoginManager.cs | 10 ++++--- AxibugEmuOnline.Server/Program.cs | 27 ++++++++++++++++--- .../PublishProfiles/FolderProfile.pubxml.user | 2 +- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/AxibugEmuOnline.Server/Manager/AppSrv.cs b/AxibugEmuOnline.Server/Manager/AppSrv.cs index 3f5ecce..2d70a58 100644 --- a/AxibugEmuOnline.Server/Manager/AppSrv.cs +++ b/AxibugEmuOnline.Server/Manager/AppSrv.cs @@ -23,7 +23,6 @@ namespace AxibugEmuOnline.Server g_Log = new LogManager(); g_Login = new LoginManager(); g_Chat = new ChatManager(); - //g_SocketMgr = new IOCPNetWork(1024, 1024); g_SocketMgr = new IOCPNetWork(1024, 4096); g_Room = new RoomManager(); diff --git a/AxibugEmuOnline.Server/Manager/LoginManager.cs b/AxibugEmuOnline.Server/Manager/LoginManager.cs index 98a8b34..f15f5ab 100644 --- a/AxibugEmuOnline.Server/Manager/LoginManager.cs +++ b/AxibugEmuOnline.Server/Manager/LoginManager.cs @@ -1,6 +1,6 @@ -using AxibugProtobuf; -using AxibugEmuOnline.Server.Common; +using AxibugEmuOnline.Server.Common; using AxibugEmuOnline.Server.NetWork; +using AxibugProtobuf; using System.Net.Sockets; namespace AxibugEmuOnline.Server.Manager @@ -16,7 +16,7 @@ namespace AxibugEmuOnline.Server.Manager { AppSrv.g_Log.Debug("收到新的登录请求"); Protobuf_Login msg = ProtoBufHelper.DeSerizlize(reqData); - ClientInfo cinfo = AppSrv.g_ClientMgr.JoinNewClient(msg, _socket); + ClientInfo _c = AppSrv.g_ClientMgr.JoinNewClient(msg, _socket); byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Login_RESP() { @@ -24,8 +24,10 @@ namespace AxibugEmuOnline.Server.Manager RegDate = "", LastLoginDate = "", Token = "", - UID = cinfo.UID + UID = _c.UID }); + + AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdLogin, (int)ErrorCode.ErrorOk, respData); } } } \ No newline at end of file diff --git a/AxibugEmuOnline.Server/Program.cs b/AxibugEmuOnline.Server/Program.cs index ea7bae9..7a81dc9 100644 --- a/AxibugEmuOnline.Server/Program.cs +++ b/AxibugEmuOnline.Server/Program.cs @@ -1,4 +1,6 @@ -namespace AxibugEmuOnline.Server +using AxibugEmuOnline.Server.Manager; + +namespace AxibugEmuOnline.Server { internal class Program { @@ -8,9 +10,28 @@ Console.ForegroundColor = ConsoleColor.Green; Console.Title = Title; AppSrv.InitServer(10492); - while (true) + while (true) { - Console.ReadLine(); + string CommandStr = Console.ReadLine(); + string Command = ""; + Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" "))); + switch (Command) + { + case "list": + { + AppSrv.g_Log.Info("当前在线:" + AppSrv.g_ClientMgr.GetOnlineClient()); + var onlinelist = AppSrv.g_ClientMgr.GetOnlineClientList(); + for (int i = 0; i < onlinelist.Count; i++) + { + ClientInfo cinfo = onlinelist[i]; + AppSrv.g_Log.Info($"UID->{cinfo.UID} Name->{cinfo.NickName} Ping->{cinfo.AveNetDelay}"); + } + } + break; + default: + Console.WriteLine("未知命令" + CommandStr); + break; + } } } } diff --git a/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user b/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user index cd0f7ea..66367dd 100644 --- a/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2024-09-12T05:38:45.0141937Z||;False|2024-09-12T13:37:57.6131232+08:00||;True|2024-06-28T16:25:59.3159172+08:00||;True|2024-06-28T15:30:49.8257235+08:00||; + True|2024-09-12T09:48:43.1521740Z||;True|2024-09-12T17:43:57.0504432+08:00||;True|2024-09-12T17:19:48.6392091+08:00||;True|2024-09-12T13:38:45.0141937+08:00||;False|2024-09-12T13:37:57.6131232+08:00||;True|2024-06-28T16:25:59.3159172+08:00||;True|2024-06-28T15:30:49.8257235+08:00||; \ No newline at end of file