From 163ad53e4890fbcbb87bcfd5453850beca140a0f Mon Sep 17 00:00:00 2001 From: Mili Date: Sat, 25 Feb 2023 21:19:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0BaseServerModel=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9ThreadManager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGame.Server/Controller/ServerController.cs | 6 ------ FunGame.Server/Model/ServerModel.cs | 17 +++++++++-------- FunGame.Server/Others/Config.cs | 6 +++--- FunGame.Server/Utility/Utility.cs | 6 +++--- 4 files changed, 15 insertions(+), 20 deletions(-) delete mode 100644 FunGame.Server/Controller/ServerController.cs diff --git a/FunGame.Server/Controller/ServerController.cs b/FunGame.Server/Controller/ServerController.cs deleted file mode 100644 index 048c59d..0000000 --- a/FunGame.Server/Controller/ServerController.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace FunGame.Server.Controller -{ - internal class ServerController - { - } -} diff --git a/FunGame.Server/Model/ServerModel.cs b/FunGame.Server/Model/ServerModel.cs index 4c3a22b..d244339 100644 --- a/FunGame.Server/Model/ServerModel.cs +++ b/FunGame.Server/Model/ServerModel.cs @@ -2,20 +2,21 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Network; using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Core.Library.Server; using Milimoe.FunGame.Server.Others; using Milimoe.FunGame.Server.Utility; namespace Milimoe.FunGame.Server.Model { - public class ServerModel + public class ServerModel : BaseModel { /** * Public */ - public bool Running = false; - public ClientSocket? Socket = null; - public Task? Task = null; - public string ClientName = ""; + public new bool Running = false; + public new ClientSocket? Socket = null; + public new Task? Task = null; + public new string ClientName = ""; /** * Private @@ -32,7 +33,7 @@ namespace Milimoe.FunGame.Server.Model Running = running; } - public bool Read(ClientSocket socket) + public override bool Read(ClientSocket socket) { // 接收客户端消息 try @@ -140,7 +141,7 @@ namespace Milimoe.FunGame.Server.Model } } - public bool Send(ClientSocket socket, SocketMessageType type, params object[] objs) + public override bool Send(ClientSocket socket, SocketMessageType type, params object[] objs) { // 发送消息给客户端 try @@ -165,7 +166,7 @@ namespace Milimoe.FunGame.Server.Model } } - public void Start() + public override void Start() { Task StreamReader = Task.Factory.StartNew(() => { diff --git a/FunGame.Server/Others/Config.cs b/FunGame.Server/Others/Config.cs index b5bad7e..8073962 100644 --- a/FunGame.Server/Others/Config.cs +++ b/FunGame.Server/Others/Config.cs @@ -1,8 +1,8 @@ -using Milimoe.FunGame.Core.Library.Constant; -using Milimoe.FunGame.Server.Model; -using System.Collections; +using System.Collections; using System.Collections.Concurrent; using System.Text; +using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Server.Model; namespace Milimoe.FunGame.Server.Others { diff --git a/FunGame.Server/Utility/Utility.cs b/FunGame.Server/Utility/Utility.cs index 5936413..1d7dd3c 100644 --- a/FunGame.Server/Utility/Utility.cs +++ b/FunGame.Server/Utility/Utility.cs @@ -1,8 +1,8 @@ -using Milimoe.FunGame.Core.Api.Utility; +using System.Collections; +using MySql.Data.MySqlClient; +using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Server.Others; -using MySql.Data.MySqlClient; -using System.Collections; namespace Milimoe.FunGame.Server.Utility {