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阻塞的问题;优化心跳、房间、模组 * 添加枚举 * 删除多余字符 * 添加监听器的名称 * 修改了命名
51 lines
2.0 KiB
C#
51 lines
2.0 KiB
C#
using Milimoe.FunGame.Core.Interface.Entity;
|
|
using Milimoe.FunGame.Core.Library.Constant;
|
|
|
|
namespace Milimoe.FunGame.Core.Entity
|
|
{
|
|
public class Room : BaseEntity
|
|
{
|
|
public static readonly Room Empty = new();
|
|
public override long Id { get => base.Id; set => base.Id = value; }
|
|
public string Roomid { get; set; } = "-1";
|
|
public DateTime CreateTime { get; set; } = General.DefaultTime;
|
|
public User RoomMaster { get; set; } = General.UnknownUserInstance;
|
|
public RoomType RoomType { get; set; } = RoomType.All;
|
|
public string GameModule { get; set; } = "";
|
|
public string GameMap { get; set; } = "";
|
|
public RoomState RoomState { get; set; }
|
|
public bool IsRank { get; set; } = false;
|
|
public bool HasPass => Password.Trim() != "";
|
|
public string Password { get; set; } = "";
|
|
public int MaxUsers { get; set; } = 0;
|
|
public Dictionary<User, bool> UserAndIsReady { get; } = [];
|
|
public GameStatistics Statistics { get; set; }
|
|
|
|
internal Room()
|
|
{
|
|
Statistics = new(this);
|
|
}
|
|
|
|
internal Room(long id = 0, string roomid = "-1", DateTime? createTime = null, User? roomMaster = null, RoomType roomType = RoomType.All, string gameModule = "", string gameMap = "", RoomState roomState = RoomState.Created, bool isRank = false, string password = "", int maxUsers = 4)
|
|
{
|
|
Id = id;
|
|
Roomid = roomid;
|
|
CreateTime = createTime ?? General.DefaultTime;
|
|
RoomMaster = roomMaster ?? General.UnknownUserInstance;
|
|
RoomType = roomType;
|
|
GameModule = gameModule;
|
|
GameMap = gameMap;
|
|
RoomState = roomState;
|
|
IsRank = isRank;
|
|
Password = password;
|
|
MaxUsers = maxUsers;
|
|
Statistics = new(this);
|
|
}
|
|
|
|
public override bool Equals(IBaseEntity? other)
|
|
{
|
|
return other is Room r && r.Roomid == Roomid;
|
|
}
|
|
}
|
|
}
|