From c69e6ff0bfb274ec8c5a10e4624870515b1d1e1c Mon Sep 17 00:00:00 2001 From: Mili Date: Thu, 8 Sep 2022 00:04:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGameServer/Main.cs | 7 ++++++- FunGameServer/Models/Config/Config.cs | 4 +++- FunGameServer/Sockets/ClientSocket.cs | 2 +- FunGameServer/Utils/ServerHelper.cs | 5 +++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/FunGameServer/Main.cs b/FunGameServer/Main.cs index d915ae3..72815e0 100644 --- a/FunGameServer/Main.cs +++ b/FunGameServer/Main.cs @@ -10,6 +10,7 @@ using FunGameServer.Utils; using FunGame.Core.Api.Model.Enum; Console.Title = Config.SERVER_NAME; +Console.WriteLine(FunGameEnums.GetInfo(Config.FunGameType)); bool Running = true; Socket? ServerSocket = null; @@ -54,6 +55,9 @@ void StartServer() try { ServerHelper.WriteLine("正在读取配置文件并初始化服务 . . ."); + // 初始化命令菜单 + ServerHelper.InitOrderList(); + // 检查是否存在配置文件 if (!Config.DefaultINIHelper.ExistINIFile()) { @@ -85,7 +89,8 @@ void StartServer() // 开始监听连接 ServerSocket.Listen(Config.MAX_PLAYERS); - ServerHelper.WriteLine("服务器启动成功,端口号 " + Config.SERVER_PORT + " ,开始监听 . . ."); + ServerHelper.WriteLine("Listen -> " + Config.SERVER_PORT); + ServerHelper.WriteLine("服务器启动成功,开始监听 . . ."); if (Config.SERVER_NOTICE != "") ServerHelper.WriteLine("\n\n********** 服务器公告 **********\n\n" + Config.SERVER_NOTICE + "\n"); diff --git a/FunGameServer/Models/Config/Config.cs b/FunGameServer/Models/Config/Config.cs index 56d13d5..f84f57c 100644 --- a/FunGameServer/Models/Config/Config.cs +++ b/FunGameServer/Models/Config/Config.cs @@ -1,4 +1,5 @@ -using FunGame.Core.Api.Util; +using FunGame.Core.Api.Model.Enum; +using FunGame.Core.Api.Util; using FunGameServer.Utils; using System; using System.Collections; @@ -26,6 +27,7 @@ namespace FunGameServer.Models.Config public static int ONLINE_PLAYERS = 0; // 已连接的玩家数量 public static int CONNECTING_PLAYERS = 0; // 正在连接的玩家数量 public static Encoding DEFAULT_ENCODING = Encoding.UTF8; // 默认传输字符集 + public static FunGameEnums.FunGame FunGameType = FunGameEnums.FunGame.FunGame_Server; public static Hashtable OrderList = new(); diff --git a/FunGameServer/Sockets/ClientSocket.cs b/FunGameServer/Sockets/ClientSocket.cs index 170e601..97d5f18 100644 --- a/FunGameServer/Sockets/ClientSocket.cs +++ b/FunGameServer/Sockets/ClientSocket.cs @@ -52,7 +52,7 @@ namespace FunGameServer.Sockets case (int)CommonEnums.SocketType.Login: break; case (int)CommonEnums.SocketType.CheckLogin: - msg = ">> 已连接至服务器 -> [ " + Config.SERVER_NAME + " ] 连接成功"; + msg = ">> 欢迎回来, " + msg + " 。"; break; case (int)CommonEnums.SocketType.Logout: break; diff --git a/FunGameServer/Utils/ServerHelper.cs b/FunGameServer/Utils/ServerHelper.cs index 4b2e076..4597dfa 100644 --- a/FunGameServer/Utils/ServerHelper.cs +++ b/FunGameServer/Utils/ServerHelper.cs @@ -66,6 +66,11 @@ namespace FunGameServer.Utils } } + public static void InitOrderList() + { + Config.OrderList.Add("Help", "Milimoe -> 帮助"); + } + public static bool IsIP(string ip) { //判断是否为IP