Skip to content

Commit

Permalink
Version 5.2
Browse files Browse the repository at this point in the history
Consolidated the GameCenterManager for iOS and OS X classes into one class. Improved Singleton. 64-bit compatible. Bug fixes and enhancements. Documentation improvements.
  • Loading branch information
iRare Media committed Nov 28, 2013
1 parent 5c04697 commit e76c965
Show file tree
Hide file tree
Showing 63 changed files with 173 additions and 3,595 deletions.
Binary file removed [email protected]
Binary file not shown.
5 changes: 2 additions & 3 deletions GameCenterManager Mac/AppDelegateMac.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
//

#import <Cocoa/Cocoa.h>
#import "GameCenterManager-Mac.h"
#import "GameCenterManager.h"

@interface AppDelegateMac : NSObject <NSApplicationDelegate, GameCenterManagerDelegate, GKGameCenterControllerDelegate, GKLeaderboardViewControllerDelegate,
GKAchievementViewControllerDelegate>
@interface AppDelegateMac : NSObject <NSApplicationDelegate, GameCenterManagerDelegate, GKGameCenterControllerDelegate, GKLeaderboardViewControllerDelegate, GKAchievementViewControllerDelegate>

@property (assign) IBOutlet NSWindow *window;
@property (strong) IBOutlet NSTextField *gcStatusTitle;
Expand Down
56 changes: 29 additions & 27 deletions GameCenterManager Mac/AppDelegateMac.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,47 +96,43 @@ - (void)gameCenterManager:(GameCenterManager *)manager availabilityChanged:(NSDi
}
}

- (void)gameCenterManager:(GameCenterManager *)manager authenticateUser:(NSViewController *)gameCenterLoginController {
NSLog(@"Please Login");
}

- (void)gameCenterManager:(GameCenterManager *)manager error:(NSDictionary *)error {
NSLog(@"GC Error: %@", error);
if ([[error objectForKey:@"error"] isEqualToString:@"Could not save achievement. Data missing."]) {
gcStatusMessage.stringValue = [NSString stringWithFormat:@"Could not save achievement. Data missing."];
}
}

- (void)gameCenterManager:(GameCenterManager *)manager reportedScore:(NSDictionary *)scoreInformation {
NSLog(@"GC Reported Score: %@", scoreInformation);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Reported leaderboard score to GameCenter."];
}

- (void)gameCenterManager:(GameCenterManager *)manager savedScore:(GKScore *)score {
NSLog(@"Saved GC Score with value: %lld", score.value);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Score saved for upload to GameCenter."];
- (void)gameCenterManager:(GameCenterManager *)manager reportedAchievement:(GKAchievement *)achievement withError:(NSError *)error {
if (!error) {
NSLog(@"GCM Reported Achievement: %@", achievement);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Reported achievement with %.1f percent completed", achievement.percentComplete];
} else {
NSLog(@"GCM Error while reporting achievement: %@", error);
}
}

- (void)gameCenterManager:(GameCenterManager *)manager savedAchievement:(NSDictionary *)achievementInformation {
NSLog(@"Saved GC Achievement, %@", [achievementInformation objectForKey:@"id"]);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Achievement saved for upload to GameCenter."];
- (void)gameCenterManager:(GameCenterManager *)manager reportedScore:(GKScore *)score withError:(NSError *)error {
if (!error) {
NSLog(@"GCM Reported Score: %@", score);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Reported leaderboard score: %lld", score.value];
} else {
NSLog(@"GCM Error while reporting score: %@", error);
}
}

- (void)gameCenterManager:(GameCenterManager *)manager reportedAchievement:(NSDictionary *)achievementInformation {
NSLog(@"GC Reported Achievement: %@", achievementInformation);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Reported achievement to GameCenter."];
- (void)gameCenterManager:(GameCenterManager *)manager didSaveScore:(GKScore *)score {
NSLog(@"Saved GCM Score with value: %lld", score.value);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Score saved for upload to GameCenter."];
}

- (void)gameCenterManager:(GameCenterManager *)manager resetAchievements:(NSError *)error {
if (error) {
gcActionInfo.stringValue = [NSString stringWithFormat:@"Error reseting all GameCenter achievements."];
} else {
gcActionInfo.stringValue = [NSString stringWithFormat:@"Reset all GameCenter achievements."];
}
- (void)gameCenterManager:(GameCenterManager *)manager didSaveAchievement:(GKAchievement *)achievement {
NSLog(@"Saved GCM Achievement: %@", achievement);
gcActionInfo.stringValue = [NSString stringWithFormat:@"Achievement saved for upload to GameCenter."];
}

- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController {

NSLog(@"%@ finished", gameCenterViewController);
}

//------------------------------------------------------------------------------------------------------------//
Expand Down Expand Up @@ -204,7 +200,13 @@ - (void)achievementViewControllerDidFinish:(GKAchievementViewController *)viewCo
}

- (IBAction)resetAchievements:(id)sender {
[[GameCenterManager sharedManager] resetAchievements];
[[GameCenterManager sharedManager] resetAchievementsWithCompletion:^(NSError *error) {
if (error) {
gcActionInfo.stringValue = [NSString stringWithFormat:@"Error reseting all GameCenter achievements."];
} else {
gcActionInfo.stringValue = [NSString stringWithFormat:@"Reset all GameCenter achievements."];
}
}];
}

//------------------------------------------------------------------------------------------------------------//
Expand All @@ -213,7 +215,7 @@ - (IBAction)resetAchievements:(id)sender {
#pragma mark - GameCenter Challenges

- (IBAction)loadChallenges:(id)sender {
//This feature is only supported in OS X 10.8.2 and higher
// This feature is only supported in OS X 10.8.2 and higher
[[GameCenterManager sharedManager] getChallengesWithCompletion:^(NSArray *challenges, NSError *error) {
gcActionInfo.stringValue = [NSString stringWithFormat:@"Loaded GameCenter challenges."];
NSLog(@"GC Challenges: %@", challenges);
Expand Down
117 changes: 0 additions & 117 deletions GameCenterManager Mac/GC Manager/GameCenterManager-Mac.h

This file was deleted.

Loading

0 comments on commit e76c965

Please sign in to comment.