Hello
It turns out that I have 1 leaderboard but the result that my App shows does not match what I have on the server.
What could be the problem?
Do the following.
First check the Learderboard directly from the server.
Then check how it appears in my app and the leaderboard of my app does not show the first hits.
To check if my code was erroneous, create a new project and import Combu 3, I put the corresponding data and it shows the same as in my app
12 entries appear on the server and the leaderboard of the app shows only 4
This is the result of the server
Rank Rank Player Score Score
No results
1 isasaurio 80100
2 niñoratuno 79700
3 niñorataaa 78400
4 claxpe 74500
5 aa 73700
6 juanp 56700
7 juancine12 52400
8 Natalia Fuentes 51900
9 juancine1 45600
10 panchobb 41900
11 loreto cifuentes 26900
12 isaias 1001
And this is the app
1) niñorataaa: 78400
2) juanp: 56700
3) Natalia Fuentes: 51900
4) panchobb: 41900
Attached screenshots.
What could be failing?
Greetings from Chile.
It depends on how you're retrieving the results, that is what's the method you're calling to load the scores.
For example, the method CombuManager.platform.LoadScores has few overloads:
- one that accepts only the leaderboard's Id and callback (default timeScope is TimeScope.Week, that is only the scores sent/updated in the last 7 days)
- one that accepts leaderboard's Id, page, countPerPage and callback (default timeScope is TimeScope.Week)
- one that accepts leaderboard's Id, timeScope, page, countPerPage and callback
The admin page is using the method corresponding to the overload that accepts also the timeScope (and pass Total as time scope), it corresponds to the Unity call (id="123", page=1, countPerPage=10):
CombuManager.platform.LoadScores("123", TimeScope.AllTime, 1, 10, (IScore[] scores) =>
{ Debug.Log("Scores: " + scores.Length);
});
FRANCESCO CROCETTI @ SKARED CREATIONS
This is my script to load scores
public void LeaderboardsScores()
{
leaderboardError.text = "";
textLeaderboardScores.text = "Cargando...";
// Load the leaderboard to retrieve the title, description, scores etc.
CombuManager.platform.LoadScores(leaderboardId, (IScore[] scores) => {
if (scores.Length == 0)
{
textLeaderboardScores.text = "No hay registros";
}
else
{
textLeaderboardScores.text = "";
for (int i = 0; i < scores.Length; ++i)
{
Score score = (Score)scores[i];
if (i > 0)
textLeaderboardScores.text += "\n";
textLeaderboardScores.text += string.Format("{0}) {1}: {2}",
score.rank,
score.user.userName,
score.formattedValue);
}
}
});
}
What would be the code that I would have to put to see the "TOP 10", try putting the example you gave me but I throw an error.
"Assets/Top10.cs(91,31): error CS1501: No overload for method `LoadScores' takes `5' arguments"
Thanks !!
Exactly the first line of code that I put in my answer, put it instead of the line where you're calling LoadScores and replace "123" with leaderboardId.
Oh you need the latest version of Combu in order to use the above overload method, what version are you using now? If you can upgrade to latest it would be better, because it contains some bug fixes and improvements.
FRANCESCO CROCETTI @ SKARED CREATIONS
Hello
Realize exactly what you told me but I get this error.
Assets/Top10.cs(91,31): error CS1501: No overload for method `LoadScores' takes `5' arguments
Ah ok sorry, I missed the last sentence of your post, so you're probably not using version 3.1.0 (if you can then you should upgrade to 3.1.0, read my previous edit).
For versions lower than 3.1.0 then you must use the way of Unity.ISocialPlatform implementation, this code should work (not tested):
public void LeaderboardsScores() { leaderboardError.text = ""; textLeaderboardScores.text = "Cargando..."; // Load the leaderboard to retrieve the title, description, scores etc. Leaderboard leaderboard = new Leaderboard(); leaderboard.id = leaderboardId; leaderboard.timeScope = UnityEngine.SocialPlatforms.TimeScope.AllTime; leaderboard.range = new UnityEngine.SocialPlatforms.Range(1, 10); leaderboard.LoadScores((bool success) => { if (leaderboard.scores.Length == 0) { textLeaderboardScores.text = "No hay registros"; } else { textLeaderboardScores.text = ""; for (int i = 0; i < leaderboard.scores.Length; ++i) { Score score = (Score)leaderboard.scores[i]; if (i > 0) textLeaderboardScores.text += "\n"; textLeaderboardScores.text += string.Format("{0}) {1}: {2}", score.rank, score.user.userName, score.formattedValue); } } }); }
FRANCESCO CROCETTI @ SKARED CREATIONS
Exactly the first line of code that I put in my answer, put it instead of the line where you're calling LoadScores and replace "123" with leaderboardId.
Oh you need the latest version of Combu in order to use the above overload method, what version are you using now? If you can upgrade to latest it would be better, because it contains some bug fixes and improvements.
Client Version 3.0.15 - Require update: NO
Exactly the first line of code that I put in my answer, put it instead of the line where you're calling LoadScores and replace "123" with leaderboardId.
Oh you need the latest version of Combu in order to use the above overload method, what version are you using now? If you can upgrade to latest it would be better, because it contains some bug fixes and improvements.
Client Version 3.0.15 - Require update: NO
Yes I still have to prepare the package for the auto-updater, anyway the latest package is available on this website (and sent to Asset Store for the review team to approve). To manually update the server you only need to uncompress the zip, delete the file /lib/config.php and upload the folder to server overwriting all files (there's no SQL queries to execute in the update 3.1.0).
PS: also remember that when you upgrade/auto-upgrade the server you still need to download the unitypackage to update the Unity files.
FRANCESCO CROCETTI @ SKARED CREATIONS
Thank you!
Download the file again from "My Downloads" and the code you gave me turned out.
Thank you so much!!!!