Game Development Reference
In-Depth Information
Center examples are based on the isometric game developed in Chapter 11 . You'll find
the following example code in the IsoTilemap04 project.
One of your game's classes can then use this functionality and register itself as a
GameKitHelper delegate to get notified of events as they occur. To do that, the del-
egate must implement the GameKitHelper @protocol that's defined in the
GameKitHelper.h header file ( Listing 14-2 ) . Only classes implementing this pro-
tocol can be assigned to the GameKitHelper delegate property to receive the
protocol messages. The protocol is simply a list of method definitions that a class using
the protocol must implement. If any of the methods in the protocol aren't implemented,
the compiler will let you know about that.
Listing 14-2 . The GameKitHelper Header File
#import "cocos2d.h"
#import < GameKit/GameKit.h>
@protocol GameKitHelperProtocol < NSObject>
@optional
-(void) onLocalPlayerAuthenticationChanged;
-(void) onFriendListReceived:(NSArray*)friends;
-(void) onPlayerInfoReceived:(NSArray*)players;
@end
@interface GameKitHelper : NSObject < GKLeaderboardViewControllerDelegate, ←
GKAchievementViewControllerDelegate>
{
id < GameKitHelperProtocol > delegate;
BOOL isGameCenterAvailable;
NSError* lastError;
}
@property (nonatomic, retain) id < GameKitHelperProtocol > delegate;
@property (nonatomic, readonly) BOOL isGameCenterAvailable;
@property (nonatomic, readonly) NSError* lastError;
+(GameKitHelper*) sharedGameKitHelper;
 
 
Search Nedrilad ::




Custom Search