Game Development Reference
In-Depth Information
// Player authentication, info
-(void) authenticateLocalPlayer;
-(void) getLocalPlayerFriends;
-(void) getPlayerInfo:(NSArray*)players;
@end
For your convenience, the GameKitHelper class also stores the last error in its
lastError property. This lets you check whether any error occurred and, if so, what
kind of error, without actually receiving the Game Center messages directly. The
GameKitHelper class is a singleton, which was described in Chapter 3 , so I'll leave
the singleton-specific code out of the discussion.
I discuss the remaining properties and methods shortly. For now, take a look at how the
TileMapLayer class is extended so that it can function as the delegate for
GameKitHelper . The essential changes to the header file are importing
GameKitHelper.h and specifying that TileMapLayer implements
GameKitHelperProtocol :
#import "GameKitHelper.h"
...
@interface TileMapLayer : CCLayer < GameKitHelperProtocol>
{
...
}
Then you can set the TileMapLayer class to be the delegate of the
GameKitHelper class, in the init method:
-(id) init
{
self = [super init];
if (self)
{
GameKitHelper* gkHelper = [GameKitHelper sharedGameKitHelper];
gkHelper.delegate = self;
[gkHelper authenticateLocalPlayer];
Search Nedrilad ::




Custom Search