mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-21 11:39:35 +08:00
Modify Room
This commit is contained in:
parent
35382bf703
commit
83699eb766
@ -5,11 +5,12 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
{
|
{
|
||||||
public class Room : BaseEntity
|
public class Room : BaseEntity
|
||||||
{
|
{
|
||||||
|
public static readonly Room Empty = new();
|
||||||
public override long Id { get => base.Id ; set => base.Id = value; }
|
public override long Id { get => base.Id ; set => base.Id = value; }
|
||||||
public string Roomid { get; set; } = "-1";
|
public string Roomid { get; set; } = "-1";
|
||||||
public DateTime CreateTime { get; set; } = General.DefaultTime;
|
public DateTime CreateTime { get; set; } = General.DefaultTime;
|
||||||
public Dictionary<string, User> Players { get; set; } = new();
|
public Dictionary<string, User> Players { get; set; } = new();
|
||||||
public User? RoomMaster { get; set; }
|
public User RoomMaster { get; set; } = General.UnknownUserInstance;
|
||||||
public RoomType RoomType { get; set; }
|
public RoomType RoomType { get; set; }
|
||||||
public RoomState RoomState { get; set; }
|
public RoomState RoomState { get; set; }
|
||||||
public bool HasPass => Password.Trim() != "";
|
public bool HasPass => Password.Trim() != "";
|
||||||
@ -26,7 +27,7 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
this.Roomid = Roomid;
|
this.Roomid = Roomid;
|
||||||
this.CreateTime = CreateTime ?? General.DefaultTime;
|
this.CreateTime = CreateTime ?? General.DefaultTime;
|
||||||
this.RoomMaster = RoomMaster;
|
this.RoomMaster = RoomMaster ?? General.UnknownUserInstance;
|
||||||
this.RoomType = RoomType;
|
this.RoomType = RoomType;
|
||||||
this.RoomState = RoomState;
|
this.RoomState = RoomState;
|
||||||
this.Password = Password;
|
this.Password = Password;
|
||||||
|
@ -7,6 +7,7 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
{
|
{
|
||||||
public class User : BaseEntity
|
public class User : BaseEntity
|
||||||
{
|
{
|
||||||
|
public static readonly User Empty = new();
|
||||||
public override Guid Guid { get; set; } = Guid.NewGuid();
|
public override Guid Guid { get; set; } = Guid.NewGuid();
|
||||||
public override long Id { get; set; }
|
public override long Id { get; set; }
|
||||||
public string Username { get; set; } = "";
|
public string Username { get; set; } = "";
|
||||||
|
@ -47,7 +47,7 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
|||||||
|
|
||||||
case RoomQuery.Column_RoomMaster:
|
case RoomQuery.Column_RoomMaster:
|
||||||
string master = reader.GetString() ?? "";
|
string master = reader.GetString() ?? "";
|
||||||
room.RoomMaster = JsonSerializer.Deserialize<User>(master, options);
|
room.RoomMaster = JsonSerializer.Deserialize<User>(master, options) ?? General.UnknownUserInstance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RoomQuery.Column_RoomType:
|
case RoomQuery.Column_RoomType:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user