服务端逻辑修改

This commit is contained in:
sin365 2024-09-13 10:10:14 +08:00
parent 5b8ed639f3
commit d567cd9e71
4 changed files with 31 additions and 9 deletions

View File

@ -23,7 +23,6 @@ namespace AxibugEmuOnline.Server
g_Log = new LogManager(); g_Log = new LogManager();
g_Login = new LoginManager(); g_Login = new LoginManager();
g_Chat = new ChatManager(); g_Chat = new ChatManager();
//g_SocketMgr = new IOCPNetWork(1024, 1024);
g_SocketMgr = new IOCPNetWork(1024, 4096); g_SocketMgr = new IOCPNetWork(1024, 4096);
g_Room = new RoomManager(); g_Room = new RoomManager();

View File

@ -1,6 +1,6 @@
using AxibugProtobuf; using AxibugEmuOnline.Server.Common;
using AxibugEmuOnline.Server.Common;
using AxibugEmuOnline.Server.NetWork; using AxibugEmuOnline.Server.NetWork;
using AxibugProtobuf;
using System.Net.Sockets; using System.Net.Sockets;
namespace AxibugEmuOnline.Server.Manager namespace AxibugEmuOnline.Server.Manager
@ -16,7 +16,7 @@ namespace AxibugEmuOnline.Server.Manager
{ {
AppSrv.g_Log.Debug("收到新的登录请求"); AppSrv.g_Log.Debug("收到新的登录请求");
Protobuf_Login msg = ProtoBufHelper.DeSerizlize<Protobuf_Login>(reqData); Protobuf_Login msg = ProtoBufHelper.DeSerizlize<Protobuf_Login>(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() byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Login_RESP()
{ {
@ -24,8 +24,10 @@ namespace AxibugEmuOnline.Server.Manager
RegDate = "", RegDate = "",
LastLoginDate = "", LastLoginDate = "",
Token = "", Token = "",
UID = cinfo.UID UID = _c.UID
}); });
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdLogin, (int)ErrorCode.ErrorOk, respData);
} }
} }
} }

View File

@ -1,4 +1,6 @@
namespace AxibugEmuOnline.Server using AxibugEmuOnline.Server.Manager;
namespace AxibugEmuOnline.Server
{ {
internal class Program internal class Program
{ {
@ -10,7 +12,26 @@
AppSrv.InitServer(10492); 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;
}
} }
} }
} }

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<History>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||;</History> <History>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||;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
</Project> </Project>