From eee995433cc8f2772ed3f3251c1a2f14bcb8b3fb Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 15 Nov 2023 22:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0GameStatistics=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Statistics/GameStatistics.cs | 11 +++++++---- Entity/System/Room.cs | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Entity/Statistics/GameStatistics.cs b/Entity/Statistics/GameStatistics.cs index 79fe591..c748779 100644 --- a/Entity/Statistics/GameStatistics.cs +++ b/Entity/Statistics/GameStatistics.cs @@ -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 DamageStats { get; set; } = new(); @@ -68,5 +66,10 @@ namespace Milimoe.FunGame.Core.Entity public Dictionary RatingStats { get; } = new(); // 结算后的Rating public Dictionary EloStats { get; } = new(); // Elo分数变化(+/-) public Dictionary RankStats { get; } = new(); // 结算后的Rank(非比赛前) + + public GameStatistics(Room Room) + { + this.Room = Room; + } } } diff --git a/Entity/System/Room.cs b/Entity/System/Room.cs index 4c49743..6a227c2 100644 --- a/Entity/System/Room.cs +++ b/Entity/System/Room.cs @@ -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)