mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 03:59:35 +08:00

* 重做 WebSocket 监听;为服务器统一了多种数据连接访问时的处理;统一编码为 UTF-8 * ModelManager已更名并移动到工具命名空间中 * 完成 WebSocket 消息处理系统 * 添加Socket异步接收数据流;修复TaskUtility阻塞的问题;优化心跳、房间、模组 * 添加枚举 * 删除多余字符 * 添加监听器的名称 * 修改了命名
95 lines
2.4 KiB
C#
95 lines
2.4 KiB
C#
using System.Text;
|
||
using Milimoe.FunGame.Core.Entity;
|
||
|
||
namespace Milimoe.FunGame.Core.Library.Constant
|
||
{
|
||
/// <summary>
|
||
/// 此类保存常用的对象常量
|
||
/// </summary>
|
||
public class General
|
||
{
|
||
#region Static Variable
|
||
|
||
/// <summary>
|
||
/// 空的实体类 用于object返回
|
||
/// </summary>
|
||
public static Empty EntityInstance => new();
|
||
|
||
/// <summary>
|
||
/// 默认的未知用户
|
||
/// </summary>
|
||
public static User UnknownUserInstance => new();
|
||
|
||
/// <summary>
|
||
/// 游客用户
|
||
/// </summary>
|
||
public static User GuestUserInstance => new(UserType.Guest);
|
||
|
||
/// <summary>
|
||
/// 本地用户
|
||
/// </summary>
|
||
public static User LocalUserInstance => new(UserType.LocalUser);
|
||
|
||
/// <summary>
|
||
/// 大厅(空房间)实例
|
||
/// </summary>
|
||
public static Room HallInstance => new();
|
||
|
||
/// <summary>
|
||
/// 默认的字符编码
|
||
/// </summary>
|
||
public static Encoding DefaultEncoding => Encoding.UTF8;
|
||
|
||
/// <summary>
|
||
/// 默认的时间格式 yyyy-MM-dd HH:mm:ss.fff
|
||
/// </summary>
|
||
public static string GeneralDateTimeFormat => "yyyy-MM-dd HH:mm:ss.fff";
|
||
|
||
/// <summary>
|
||
/// yyyy年MM月dd日 HH:mm:ss
|
||
/// </summary>
|
||
public static string GeneralDateTimeFormatChinese => "yyyy年MM月dd日 HH:mm:ss";
|
||
|
||
/// <summary>
|
||
/// 默认的时间值(1970年8月1日8点0分0秒)
|
||
/// </summary>
|
||
public static DateTime DefaultTime => new(1970, 1, 1, 8, 0, 0);
|
||
|
||
#endregion
|
||
|
||
#region Const
|
||
|
||
/// <summary>
|
||
/// 最多自动重试连接次数
|
||
/// </summary>
|
||
public const int MaxRetryTimes = 20;
|
||
|
||
/// <summary>
|
||
/// 1C2G推荐的任务数量
|
||
/// </summary>
|
||
public const int MaxTask_1C2G = 10;
|
||
|
||
/// <summary>
|
||
/// 2C2G推荐的任务数量
|
||
/// </summary>
|
||
public const int MaxTask_2C2G = 20;
|
||
|
||
/// <summary>
|
||
/// 4C4G推荐的任务数量
|
||
/// </summary>
|
||
public const int MaxTask_4C4G = 40;
|
||
|
||
/// <summary>
|
||
/// 默认Socket数据包大小
|
||
/// </summary>
|
||
public const int SocketByteSize = 512 * 1024;
|
||
|
||
/// <summary>
|
||
/// 默认Stream传输大小
|
||
/// </summary>
|
||
public const int StreamByteSize = 2048;
|
||
|
||
#endregion
|
||
}
|
||
}
|