LoadScoreByUser pro...
 
Notifications
Clear all

LoadScoreByUser problem

4 Posts
2 Users
0 Reactions
456 Views
(@agm)
Posts: 6
Active Member
Topic starter
 

Hello. I must apologice if this question is a bit stupid but i have been fighting a lot and i´m really overflowed.

I am trying to read the max score from the leaderboard "123" and for the user already signed in.

As I read in the manual, the syntax must be: 

// Load the best score of leaderboard ID ’123’ for the User object with 1 results per page (to be
attendible ’page’, the limit must be the same as used with LoadScores)
Leaderboard.LoadScoresByUser("123", CombuManager.localUser, eLeaderboardInterval.Total, 1, (Score score,
int page, string error) => {
if (score != null)
Debug.Log("Success: " + score.value + " at page " + page);
else
Debug.Log("Failed: " + error);
});

As LoadScoresByUser is deprecated i changed it to LoadScoreByUser, but i have always the same error with both of them:

No overload for method 'LoadScoreByUser' takes 5 arguments.

When I search in the API documentation, it says:

virtual void Combu.CombuPlatform.LoadScoresByUser ( string  leaderboardId,
    User  user,
    eLeaderboardInterval  interval,
    int  limit,
    System.Action< Score, int, string >  callback 
  )

But the example is:

CombuManager.platform.LoadScores ("1234", CombuManager.localUser, eLeaderboardInterval.Week, 10, (Score score, int page, string error) => {
Debug.Log("Score: " + score.rank);
});
 
So I decided to change to LoadScores, but then CombuManager.localUser  says:
Argument 2 cannot convert from Combu.User to UnityEngine.SocialPlatforms.TimeScope
 
¿?¿?¿? I don´t know what to use or how.
 
Thank you very much
 
Posted : 25/06/2021 8:10 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

It was a bit confusing because I missed to update the API documentation when I deprecated LoadScoresByUser, I have updated the documentation right now.

Basically the method LoadScoreByUser that replaced the old LoadScoresByUser is not a static method but you have to call it from an instanced object of Leaderboard, for example:

Leaderboard leaderboard = new Leaderboard { code = "L123" };
leaderboard.LoadScoreByUser(CombuManager.localUser, eLeaderboardInterval.Total, 10, (Score score, int page, string error) =>
{
    if (!string.IsNullOrEmpty(error))
    {
        Debug.LogError("Loading score failed: " + error);
    }
    else
    {
        // Use score.value (long), score.valueFloat (float) or score.valueDouble (double)
        // depending on the type of score that you know is stored for this leaderboard
        Debug.Log(string.Format("New score rank #{0} with value {1} at page {2}", score.rank, score.value, page));
    }
});

About platform object, the method that you were calling (CombuManager.platform.LoadScores) has a totally different sign (check it in the script CombuPlatform.cs) and it's used to retrieve the scores pages from a leaderboard not depending on a specific user.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 29/06/2021 9:00 am
(@agm)
Posts: 6
Active Member
Topic starter
 

@skaredcreations Thank you very much. I will try it this afternoon. Many many thanks.

LoadScores appears in the example of LoadScoresByUser in the API documentation. Thats why i finally open this thread. I didn´t know really what to use 🙂 

Thank you again for this great asset.

 
Posted : 29/06/2021 4:12 pm
(@agm)
Posts: 6
Active Member
Topic starter
 

@skaredcreations All perfect. Thank you very much.

 
Posted : 30/06/2021 7:25 pm
Share: