修改RoomEventArgs构造函数

This commit is contained in:
milimoe 2023-12-10 23:56:30 +08:00
parent 3228addf9e
commit 3290278df4
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E

View File

@ -9,25 +9,18 @@ namespace Milimoe.FunGame.Core.Library.Common.Event
public Room Room { get; set; } = General.HallInstance; public Room Room { get; set; } = General.HallInstance;
public string RoomID { get; set; } = ""; public string RoomID { get; set; } = "";
public long RoomMaster { get; set; } = 0; public long RoomMaster { get; set; } = 0;
public string RoomTypeString { get; set; } = RoomSet.All;
public RoomType RoomType { get; set; } = RoomType.All; public RoomType RoomType { get; set; } = RoomType.All;
public string RoomTypeString { get; set; } = RoomSet.All;
public string GameMode { get; set; } = ""; public string GameMode { get; set; } = "";
public string GameMap { get; set; } = ""; public string GameMap { get; set; } = "";
public RoomState RoomState { get; set; } = RoomState.Created; public RoomState RoomState { get; set; } = RoomState.Created;
public bool HasPassword => Password.Trim() != ""; public bool HasPassword => Password.Trim() != "";
public string Password { get; set; } = ""; public string Password { get; set; } = "";
public RoomEventArgs(string type, string password) public RoomEventArgs(RoomType type, string password)
{ {
RoomTypeString = type; RoomType = type;
RoomType = type switch RoomTypeString = RoomSet.GetTypeString(type);
{
RoomSet.Mix => RoomType.Mix,
RoomSet.Team => RoomType.Team,
RoomSet.FastAuto => RoomType.FastAuto,
RoomSet.Custom => RoomType.Custom,
_ => RoomType.All
};
Password = password; Password = password;
Room = Factory.GetRoom(RoomType: RoomType, Password: Password); Room = Factory.GetRoom(RoomType: RoomType, Password: Password);
} }