From 535116c2e4eec33da75dd822b6ee462e35737e6e Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 23 Feb 2022 09:06:11 -0600 Subject: [PATCH] Fix score leaderboard at end of levels (#190) --- .../Controllers/GameApi/Slots/ScoreController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ProjectLighthouse/Controllers/GameApi/Slots/ScoreController.cs b/ProjectLighthouse/Controllers/GameApi/Slots/ScoreController.cs index a73adea9..95df5843 100644 --- a/ProjectLighthouse/Controllers/GameApi/Slots/ScoreController.cs +++ b/ProjectLighthouse/Controllers/GameApi/Slots/ScoreController.cs @@ -82,7 +82,7 @@ public class ScoreController : ControllerBase await this.database.SaveChangesAsync(); - string myRanking = this.getScores(score.SlotId, score.Type, user); + string myRanking = this.getScores(score.SlotId, score.Type, user, -1, 5, "scoreboardSegment"); return this.Ok(myRanking); } @@ -105,7 +105,7 @@ public class ScoreController : ControllerBase } [SuppressMessage("ReSharper", "PossibleMultipleEnumeration")] - private string getScores(int slotId, int type, User user, int pageStart = -1, int pageSize = 5) + private string getScores(int slotId, int type, User user, int pageStart = -1, int pageSize = 5, string rootName = "scores") { // This is hella ugly but it technically assigns the proper rank to a score // var needed for Anonymous type returned from SELECT @@ -138,11 +138,11 @@ public class ScoreController : ControllerBase ); string res; - if (myScore == null) res = LbpSerializer.StringElement("scores", serializedScores); + if (myScore == null) res = LbpSerializer.StringElement(rootName, serializedScores); else res = LbpSerializer.TaggedStringElement ( - "scores", + rootName, serializedScores, new Dictionary {