I've tried to do this but just get a cast error whenever I try to get the current player's leaderboard rank. I'm using a partitioned leaderboard btw.
using:
if (response.BaseData.GetGSData("weeklymultiplayer").ContainsKey("rank"))
also tried
if (response.BaseData.GetGSData("weeklymultiplayer.game.mygamename").ContainsKey("rank"))
also tried:
if(response.ScriptData.ContainsKey("rank") )
Why is there no documentation for how to retrieve the player's leaderboard entry?
at GameSparks.Core.GSTypedRequest`2+<>c__DisplayClass1[GameSparks.Api.Requests.GetLeaderboardEntriesRequest,GameSparks.Api.Responses.GetLeaderboardEntriesResponse].<Send>b__0 (GameSparks.Core.GSObject response) [0x00008] in c:\jenkins\workspace\clientsdk-dotnet-rt-tls\GameSparks.Api\Core\GSTypedRequest.cs:118
at GameSparks.Core.GSRequest+<>c__DisplayClass4.<Complete>b__1 () [0x00000] in c:\jenkins\workspace\clientsdk-dotnet-rt-tls\GameSparks.Api\Core\GSRequest.cs:78
at GameSparks.Platforms.PlatformBase.Update () [0x0007d] in Assets\GameSparks\Platforms\PlatformBase.cs:290
UnityEngine.Debug:Log(Object)
GameSparks.Platforms.PlatformBase:Update() (at Assets/GameSparks/Platforms/PlatformBase.cs:295)
J
Jedrzej Jonasz
said
almost 4 years ago
I think it's not working because the returned leaderboard name has a bunch of extra stuff in it like SNAPSHOT and a date.. so the GetGSData(..) call always returns null as it can't find a key with the actual leaderboard name. How do we get around this?
G
Gerick Toro
said
about 6 years ago
this is my code...
public void GetScore()
{
Debug.Log ("Obteniendo el Score!");
new AccountDetailsRequest ()
.Send ((response) => {
if (!response.HasErrors) {
string PlayerID = response.UserId;
Debug.Log ("Se encontro el ID del jugador:" + PlayerID);
new GetLeaderboardEntriesRequest ().SetPlayer (PlayerID).SetLeaderboards(leadboard).Send ((response2) => {
string score = response2.JSONData["score"].ToString();
LoggedUI.transform.FindChild("FBScore").GetComponent<Text>().text = score;
});
}
});
G
Gerick Toro
said
about 6 years ago
error output:
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[System.String,System.Object].get_Item (System.String key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
LoginFacebook.<GetScore>m__4 (GameSparks.Api.Responses.GetLeaderboardEntriesResponse response2) (at Assets/00 LAFAR/03 Scripts/Social/LoginFacebook.cs:156)
GameSparks.Core.GSTypedRequest`2+<>c__DisplayClass1[GameSparks.Api.Requests.GetLeaderboardEntriesRequest,GameSparks.Api.Responses.GetLeaderboardEntriesResponse].<Send>b__0 (GameSparks.Core.GSObject response)
GameSparks.Core.GSRequest+<>c__DisplayClass4.<Complete>b__1 ()
GameSparks.Platforms.PlatformBase.Update () (at Assets/GameSparks/Platforms/PlatformBase.cs:67)
Gerick Toro
Hello, I'm not a programmer but I try.
As I can get the score of the current user?
could give me some example ?,
thank you very much
solved, using
instead of
for if it helps someone
- Oldest First
- Popular
- Newest First
Sorted by PopularGerick Toro
solved, using
instead of
for if it helps someone
1 person likes this
Jedrzej Jonasz
I've tried to do this but just get a cast error whenever I try to get the current player's leaderboard rank. I'm using a partitioned leaderboard btw.
using:
if (response.BaseData.GetGSData("weeklymultiplayer").ContainsKey("rank"))
also tried
if (response.BaseData.GetGSData("weeklymultiplayer.game.mygamename").ContainsKey("rank"))
also tried:
if(response.ScriptData.ContainsKey("rank") )
Why is there no documentation for how to retrieve the player's leaderboard entry?
Jedrzej Jonasz
I think it's not working because the returned leaderboard name has a bunch of extra stuff in it like SNAPSHOT and a date.. so the GetGSData(..) call always returns null as it can't find a key with the actual leaderboard name. How do we get around this?
Gerick Toro
this is my code...
Gerick Toro
error output:
Customer Support
Nice work Gerick.
Glad you figured it out.
Oisin
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics