0

I am using google leaderboard api.

How to get a specific player score by player id?

I want to display a merged leaderboard from scores around me(loadPlayerCenteredScores with COLLECTION_PUBLIC) and scores of my friends(loadTopScores with COLLECTION_SOCIAL)

An example of such leadeboard could be something like this:

  • friend score 2,000,000 rank 19
  • random player score 60,600 rank 2,618
  • random player score 60,500 rank 2,619
  • me score 50,390 rank 2,620
  • random player score 50,100 rank 2,621
  • random player score 48,900 rank 2,622
  • friend score 3,400 rank 99,600

My problem is that I don't know the rank of my friends in the COLLECTION_PUBLIC leaderboard. How can I get it?

P.S
While this question got the same title, it's unrelated this question.

Community
  • 1
  • 1
Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216

1 Answers1

0

The LeaderboardScore interface can be used in this scenario, in your case you would want the .getScoreHolderDisplayName() and the .getRank() method

You will need to retrieve both collections, COLLECTION_PUBLIC and COLLECTION_SOCIAL. Iterate on both collections then just use some sorting.

SwagBomb
  • 584
  • 3
  • 7