From 2cf861c175271233a373438d5a2758724686b6fb Mon Sep 17 00:00:00 2001 From: milimoe <110188673+milimoe@users.noreply.github.com> Date: Thu, 18 May 2023 10:55:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0DataRequest=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=96=B9=E6=B3=95=20(#14)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGame.Server/Model/ServerModel.cs | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/FunGame.Server/Model/ServerModel.cs b/FunGame.Server/Model/ServerModel.cs index eef1dfe..cf127e0 100644 --- a/FunGame.Server/Model/ServerModel.cs +++ b/FunGame.Server/Model/ServerModel.cs @@ -1,4 +1,5 @@ -using System.Data; +using System.Collections; +using System.Data; using Milimoe.FunGame.Core.Api.Transmittal; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; @@ -75,6 +76,11 @@ namespace Milimoe.FunGame.Server.Model return false; } + if (type == SocketMessageType.DataRequest) + { + return DataRequestHandler(socket, SocketObject); + } + // 如果不等于这些Type,就不会输出一行记录。这些Type有特定的输出。 SocketMessageType[] IgnoreType = new SocketMessageType[] { SocketMessageType.HeartBeat, SocketMessageType.Login, SocketMessageType.IntoRoom, SocketMessageType.Chat}; @@ -507,6 +513,32 @@ namespace Milimoe.FunGame.Server.Model _ClientName = ClientName; } + private bool DataRequestHandler(ClientSocket socket, SocketObject SocketObject) + { + Hashtable ResultData = new(); + DataRequestType type = DataRequestType.UnKnown; + + if (SocketObject.Parameters.Length > 0) + { + try + { + type = SocketObject.GetParam(0); + switch (type) + { + case DataRequestType.UnKnown: + break; + } + } + catch (Exception e) + { + ServerHelper.Error(e); + return false; + } + } + + return Send(socket, SocketMessageType.DataRequest, type, ResultData); + } + private void KickUser() { if (User.Id != 0)