小修改

This commit is contained in:
Mili 2022-09-08 00:04:14 +08:00
parent 4f36624d02
commit c69e6ff0bf
4 changed files with 15 additions and 3 deletions

View File

@ -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");

View File

@ -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();

View File

@ -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;

View File

@ -66,6 +66,11 @@ namespace FunGameServer.Utils
}
}
public static void InitOrderList()
{
Config.OrderList.Add("Help", "Milimoe -> 帮助");
}
public static bool IsIP(string ip)
{
//判断是否为IP