FunGame-Core/Library/Common/Event/RoomEventArgs.cs
milimoe 940f8397f1
为服务器统一数据访问连接 (#91)
* 重做 WebSocket 监听;为服务器统一了多种数据连接访问时的处理;统一编码为 UTF-8

* ModelManager已更名并移动到工具命名空间中

* 完成 WebSocket 消息处理系统

* 添加Socket异步接收数据流;修复TaskUtility阻塞的问题;优化心跳、房间、模组

* 添加枚举

* 删除多余字符

* 添加监听器的名称

* 修改了命名
2024-10-02 15:00:34 +08:00

49 lines
1.8 KiB
C#

using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Library.Common.Event
{
public class RoomEventArgs : GeneralEventArgs
{
public Room Room { get; set; } = General.HallInstance;
public string RoomID { get; set; } = "";
public long RoomMaster { get; set; } = 0;
public RoomType RoomType { get; set; } = RoomType.All;
public string RoomTypeString { get; set; } = RoomSet.All;
public string GameModule { get; set; } = "";
public string GameMap { get; set; } = "";
public RoomState RoomState { get; set; } = RoomState.Created;
public bool HasPassword => Password.Trim() != "";
public string Password { get; set; } = "";
public RoomEventArgs(RoomType type, string password)
{
RoomType = type;
RoomTypeString = RoomSet.GetTypeString(type);
Password = password;
Room = Factory.GetRoom(roomType: RoomType, password: Password);
}
public RoomEventArgs(Room room)
{
Room = room;
RoomID = room.Roomid;
RoomMaster = room.RoomMaster != null ? room.RoomMaster.Id : 0;
RoomType = room.RoomType;
GameModule = room.GameModule;
GameMap = room.GameMap;
RoomTypeString = room.RoomType switch
{
RoomType.Mix => RoomSet.Mix,
RoomType.Team => RoomSet.Team,
RoomType.FastAuto => RoomSet.FastAuto,
RoomType.Custom => RoomSet.Custom,
_ => RoomSet.All
};
RoomState = room.RoomState;
Password = room.Password;
}
}
}