milimoe e7214c3fb9
添加新的枚举、字符常量和方法 (#59)
* 添加大量新的枚举,添加缺少的枚举字符串,修改枚举转字符串方法的位置

* 添加StartGame和Gaming的SocketHandler方法

* 添加MainInvokeType.StartGame

* 优化代码格式

* 添加默认的User.ToString()

* 添加EndGame

* 添加GameMode.GetTypeString

* 添加GameMode.GetRoomType
2023-11-23 00:43:34 +08:00

47 lines
1.6 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; }
public RoomState RoomState { get; set; }
public bool HasPass => Password.Trim() != "";
public string Password { get; set; } = "";
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, RoomState RoomState = RoomState.Created, string Password = "")
{
this.Id = Id;
this.Roomid = Roomid;
this.CreateTime = CreateTime ?? General.DefaultTime;
this.RoomMaster = RoomMaster ?? General.UnknownUserInstance;
this.RoomType = RoomType;
this.RoomState = RoomState;
this.Password = Password;
Statistics = new(this);
}
public bool Equals(Room other)
{
return Equals(other);
}
public override bool Equals(IBaseEntity? other)
{
return other?.Id == Id;
}
}
}