From 35fba33216b33e7f1c50bdb9c49255c7a02a08b0 Mon Sep 17 00:00:00 2001 From: LumaLivy Date: Thu, 4 Nov 2021 00:54:51 -0400 Subject: [PATCH] Add some necessary properties for topscores --- ProjectLighthouse/Types/Score.cs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ProjectLighthouse/Types/Score.cs b/ProjectLighthouse/Types/Score.cs index 14668872..b6b4c4c5 100644 --- a/ProjectLighthouse/Types/Score.cs +++ b/ProjectLighthouse/Types/Score.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; +using LBPUnion.ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Types.Levels; namespace LBPUnion.ProjectLighthouse.Types @@ -28,12 +29,36 @@ namespace LBPUnion.ProjectLighthouse.Types [NotMapped] [XmlElement("playerIds")] - public string[] PlayerIds { + public string[] PlayerIds + { get => this.PlayerIdCollection.Split(","); set => this.PlayerIdCollection = string.Join(',', value); } + [XmlElement("mainPlayer")] + [NotMapped] + public string MainPlayer + { + get => this.PlayerIds[0]; + set => this.PlayerIds[0] = value; + } + + [XmlElement("rank")] + [NotMapped] + public int Rank { get; set; } + [XmlElement("score")] public int Points { get; set; } + + public string Serialize() + { + string score = LbpSerializer.StringElement("type", this.Type) + + LbpSerializer.StringElement("playerIds", this.PlayerIdCollection) + + LbpSerializer.StringElement("mainPlayer", this.MainPlayer) + + LbpSerializer.StringElement("rank", this.Rank) + + LbpSerializer.StringElement("score", this.Points); + + return LbpSerializer.StringElement("playRecord", score); + } } } \ No newline at end of file