Sign In Register

How can we help you today?

Start a new topic
Answered

Get players score from Partition Leaderboard

I am creating a Leaderboard with partition on level, and try to get leaderboard data in Unity

In Test Harness, I can  get high score for level1 by using this query

  

{
 "@class": ".LeaderboardDataRequest",
 "entryCount": 10,
 "leaderboardShortCode": "highScore.level.1",
 "offset": 0,
 "social": false
}

  The tutorial only mentioned getting data from normal leaderboard
 

new LeaderboardDataRequest_highScore().SetEntryCount(10).Send((response) => { ...

 This request sends shortcode "highScore", how can i create a Request with shortcode "highScore.level.1" ?

Thanks!



Best Answer

 Okay, so after a bit of trial and error, poking and prodding, I think I may have worked it out... I haven't tested it yet as I'm in the middle of gutting my game and retooling it (switching from Parse to Gamesparks), which means little at all is working fully again yet. That said, here's what appears to be the correct formatting. Please, oh please, correct me if I'm wrong here. In the example below, I have a partitioned Leaderboard with a shortcode of levelScores, organized by by an int number with the shortcode of level (set in my postScores event). For the sake of the example, I'm only gathering the first 10 high scores for level 1. Anyway, I hope that it's correct, and I hope that this information, if correct, will assist others over this particular pitfall in the future.

new LeaderboardDataRequest().SetLeaderboardShortCode("levelScores.level.1").SetEntryCount(10).Send((response) =>
		{
			// Your code for dealing with scores here...
		});

 


1 person has this question

I actually came here looking for this precise information and was quite dismayed after searching through several pages of posts to see that, not only has the issue not been addressed here after several months, but that the answer doesn't seem to have been raised or addressed elsewhere either. I'll continue my search for the proper formatting, but would certainly appreciate it if someone would chime in with the appropriate information, just in case I can't locate it elsewhere. Thanks!

 

Answer

 Okay, so after a bit of trial and error, poking and prodding, I think I may have worked it out... I haven't tested it yet as I'm in the middle of gutting my game and retooling it (switching from Parse to Gamesparks), which means little at all is working fully again yet. That said, here's what appears to be the correct formatting. Please, oh please, correct me if I'm wrong here. In the example below, I have a partitioned Leaderboard with a shortcode of levelScores, organized by by an int number with the shortcode of level (set in my postScores event). For the sake of the example, I'm only gathering the first 10 high scores for level 1. Anyway, I hope that it's correct, and I hope that this information, if correct, will assist others over this particular pitfall in the future.

new LeaderboardDataRequest().SetLeaderboardShortCode("levelScores.level.1").SetEntryCount(10).Send((response) =>
		{
			// Your code for dealing with scores here...
		});

 

Hi Kenneth,


Sorry we missed this post, we'll be going over the forums this week and marking as many posts "answered" as possible and answer those we missed ourselves.


You are correct, the reason you must use the default LeaderboardDataRequest is because when you get your "Custom SDK" from Unity we could only provide you with the partitions that have been created already, if a player never makes it to level 200 for example, that partition will not exist and we wont know to compensate for it and add that to the code.


Shane

Thanks so much for your quick response, at least to my own inquiry ;) I'm sure you fine folks are hard at work and I most certainly appreciate it. I'm glad to know that I did indeed trip upon the correct answer. I'm having some trouble wrapping my head around certain aspects of the way things work here on GameSparks, but am doing my best. At the moment, I'm scratching my head trying to figure out how to simply store and retrieve values for other types of data. It's not relevant to this particular question, of course, so I'll post my own thread if I can't find the proper way of accomplishing some of these seemingly simple tasks. Thanks again & keep up the great work!

 

Login to post a comment