添加GameStatistics构造函数

This commit is contained in:
milimoe 2023-11-15 22:21:42 +08:00
parent 8f6555687b
commit eee995433c
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
2 changed files with 10 additions and 6 deletions

View File

@ -1,11 +1,9 @@
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Entity
namespace Milimoe.FunGame.Core.Entity
{
public class GameStatistics
{
public long Id => Room.Id;
public Room Room { get; set; } = General.HallInstance;
public Room Room { get; }
public DateTime RecordTime { get; set; } = DateTime.Now;
public string Record { get; set; } = "";
public Dictionary<User, decimal> DamageStats { get; set; } = new();
@ -68,5 +66,10 @@ namespace Milimoe.FunGame.Core.Entity
public Dictionary<User, decimal> RatingStats { get; } = new(); // 结算后的Rating
public Dictionary<User, decimal> EloStats { get; } = new(); // Elo分数变化(+/-)
public Dictionary<User, string> RankStats { get; } = new(); // 结算后的Rank非比赛前
public GameStatistics(Room Room)
{
this.Room = Room;
}
}
}

View File

@ -14,11 +14,11 @@ namespace Milimoe.FunGame.Core.Entity
public RoomState RoomState { get; set; }
public bool HasPass => Password.Trim() != "";
public string Password { get; set; } = "";
public GameStatistics Statistics { get; set; } = new();
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 = "")
@ -30,6 +30,7 @@ namespace Milimoe.FunGame.Core.Entity
this.RoomType = RoomType;
this.RoomState = RoomState;
this.Password = Password;
Statistics = new(this);
}
public bool Equals(Room other)