Add some necessary properties for topscores

This commit is contained in:
LumaLivy 2021-11-04 00:54:51 -04:00
commit 35fba33216

View file

@ -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);
}
}
}