Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Returning the localplayer details in GameKit - Gideros Forum

Returning the localplayer details in GameKit

bowerandybowerandy Guru
edited September 2012 in Plugins
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)
		[[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)
		  print(string.format("authentication of %s successful. now loading friends...", self.gameCenterAlias))
Best regards


Sign In or Register to comment.