From 185fea4b4075a5ccc6139701beeab06d94f810e4 Mon Sep 17 00:00:00 2001 From: milimoe <110188673+milimoe@users.noreply.github.com> Date: Sun, 21 May 2023 14:02:18 +0800 Subject: [PATCH] Add Club (#23) --- Entity/System/Club.cs | 27 +++++++++++++++++++++++++++ Entity/System/Inventory.cs | 8 +++----- Entity/System/Room.cs | 8 +++----- 3 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 Entity/System/Club.cs diff --git a/Entity/System/Club.cs b/Entity/System/Club.cs new file mode 100644 index 0000000..89c0e9c --- /dev/null +++ b/Entity/System/Club.cs @@ -0,0 +1,27 @@ +using Milimoe.FunGame.Core.Interface.Entity; + +namespace Milimoe.FunGame.Core.Entity +{ + public class Club : BaseEntity + { + public string Prefix { get; set; } = ""; + public string Description { get; set; } = ""; + public bool IsNeedApproval { get; set; } = false; + public bool IsPublic { get; set; } = false; + public decimal ClubPoins { get; set; } = 0M; + public User? Master { get; set; } + public Dictionary Admins { get; set; } = new(); + public Dictionary Members { get; set; } = new(); + public Dictionary Applicants { get; set; } = new(); + + public bool Equals(Club other) + { + return Equals(other); + } + + public override bool Equals(IBaseEntity? other) + { + return other?.Id == Id; + } + } +} diff --git a/Entity/System/Inventory.cs b/Entity/System/Inventory.cs index ed547c3..24be9f5 100644 --- a/Entity/System/Inventory.cs +++ b/Entity/System/Inventory.cs @@ -1,13 +1,11 @@ -using System.Collections; - -namespace Milimoe.FunGame.Core.Entity +namespace Milimoe.FunGame.Core.Entity { public class Inventory { public int Id { get; set; } public string Name { get; set; } = ""; public User? User { get; set; } = null; - public Hashtable? Characters { get; set; } = new Hashtable(); - public Hashtable? Items { get; set; } = new Hashtable(); + public Dictionary Characters { get; set; } = new(); + public Dictionary Items { get; set; } = new(); } } diff --git a/Entity/System/Room.cs b/Entity/System/Room.cs index b7a6c4c..05d8789 100644 --- a/Entity/System/Room.cs +++ b/Entity/System/Room.cs @@ -1,9 +1,7 @@ using System.Data; -using System.Collections; using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Core.Library.SQLScript.Entity; -using System.Linq; namespace Milimoe.FunGame.Core.Entity { @@ -12,7 +10,7 @@ namespace Milimoe.FunGame.Core.Entity public override long Id { get => base.Id ; set => base.Id = value; } public string Roomid { get; set; } = ""; public DateTime CreateTime { get; set; } = DateTime.Now; - public Hashtable PlayerList { get; set; } = new Hashtable(); + public Dictionary Players { get; set; } = new(); public User? RoomMaster { get; set; } public RoomType RoomType { get; set; } public RoomState RoomState { get; set; } @@ -47,12 +45,12 @@ namespace Milimoe.FunGame.Core.Entity public bool Equals(Room other) { - return other.Id == Id; + return Equals(other); } public override bool Equals(IBaseEntity? other) { - return Equals(other); + return other?.Id == Id; } private static int GetUserRowIndex(DataSet? DsUser, long UID)