Hi
@atilim,
I take it that the iOS GameKit plugin is maintained by Gideros, is that right? If so, I have made a simple modification that you may wish to include in the next release. This is to return the local player details (such as id and alias) as part of the authentication event. This is useful information to have available.
The change is simply to replace the current authenticate() function with:
void authenticate()
{
if (isAvailable() == NO)
return;
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError* error)
{
// Let's answer details of the local player in a players array
NSArray *players= [NSArray arrayWithObject: [GKLocalPlayer localPlayer]];
dispatchEvent(AUTHENTICATE_COMPLETE, error, NULL, players, NULL, NULL);
}];
} |
Then one can get at the info up in Gideros like this:
function Game:onAuthenticateComplete(event)
if event.errorCode ~= nil then
print("error while authentication: "..event.errorDescription)
else
self.isGameCenterAuthenticated=true
self.gameCenterAlias=event.players[1].alias
print(string.format("authentication of %s successful. now loading friends...", self.gameCenterAlias))
gamekit:loadFriends()
end
end |
Best regards
Comments
I ask because I have just added a loadLeaderboard(category, timeScope, playerScope, startIndex, endIndex) function to the plugin and I've added a (scores) parameter to dispatchEvent() to do this. I hope this is the recommended way.
Would you like me to send you my recent changes too?
Best regards
I can send you the changes in a couple of hours.
Btw, if you want, we can integrate loadLeaderboard/scores changes into gamekit.mm so that these additions will be permanent and officially supported.
Best regards