using System.Collections; using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Core.Model; namespace Milimoe.FunGame.Server.Others { public static class Config { /// /// 使用 ASP.NET Core Web API /// public static bool AspNetCore { get; set; } = false; /// /// 日志级别 /// public static string LogLevel { get; set; } = "INFO"; /// /// 日志级别(枚举值) /// public static LogLevel LogLevelValue { get { return LogLevel.ToUpper() switch { "TRACE" => Core.Library.Constant.LogLevel.Trace, "DEBUG" => Core.Library.Constant.LogLevel.Debug, "INFO" => Core.Library.Constant.LogLevel.Info, "WARN" => Core.Library.Constant.LogLevel.Warning, "ERROR" => Core.Library.Constant.LogLevel.Error, "CRIT" => Core.Library.Constant.LogLevel.Critical, _ => Core.Library.Constant.LogLevel.Info }; } } /// /// 服务器名称 /// public static string ServerName { get; set; } = "FunGame Server"; /// /// Socket 端口 /// public static int ServerPort { get; set; } = 22222; /// /// 使用 WebSocket /// public static bool UseWebSocket { get; set; } = false; /// /// WebSocket 监听地址 /// public static string WebSocketAddress { get; set; } = "localhost"; /// /// WebSocket 端口 /// public static int WebSocketPort { get; set; } = 22222; /// /// WebSocket 监听子路径 /// public static string WebSocketSubUrl { get; set; } = "ws"; /// /// WebSocket 开启 SSL /// public static bool WebSocketSSL { get; set; } = false; /// /// 默认状态:1可连接 0不可连接 -1不可用 /// public static int ServerStatus { get; set; } = 1; /// /// 服务器的公告 /// public static string ServerNotice { get; set; } = ""; /// /// 服务器的密码 /// public static string ServerPassword { get; set; } = ""; /// /// 服务器的描述 /// public static string ServerDescription { get; set; } = ""; /// /// 注册社区服务器的Key /// public static string ServerKey { get; set; } = ""; /// /// 禁止连接的黑名单 /// public static List ServerBannedList { get; set; } = []; /// /// 是否使用 FunGame.Desktop 的参数检查 /// public static bool UseDesktopParameters { get; set; } = true; /// /// 最多接受连接的玩家数量 /// public static int MaxPlayers { get; set; } = 20; /// /// 最大连接失败次数 /// public static int MaxConnectionFaileds { get; set; } = 5; /// /// 已连接的玩家数量 /// public static int OnlinePlayerCount { get; set; } = 0; /// /// 正在连接的玩家数量 /// public static int ConnectingPlayerCount { get; set; } = 0; /// /// 默认传输字符集 /// public static Encoding DefaultEncoding { get; } = General.DefaultEncoding; /// /// FunGame Runtime /// public static FunGameInfo.FunGame FunGameType => FunGameInfo.FunGame.FunGame_Server; /// /// 服务器指令列表 /// public static Hashtable OrderList { get; } = []; /// /// 在线房间列表 /// public static RoomList RoomList { get; } = new(); /// /// 是否运行数据库模式 /// public static SQLMode SQLMode { get; set; } = SQLMode.None; /// /// Server实际安装的模组 /// public static GameModuleLoader? GameModuleLoader { get; set; } /// /// Server插件 /// public static ServerPluginLoader? ServerPluginLoader { get; set; } /// /// Web API插件 /// public static WebAPIPluginLoader? WebAPIPluginLoader { get; set; } /// /// 未Loadmodules时,此属性表示至少需要安装的模组 /// public static string[] GameModuleSupported { get; set; } = []; } /// /// 此服务器的联系邮箱 /// public static class OfficialEmail { public static string Email { get; set; } = ""; public static string SupportEmail { get; set; } = ""; } }