[英]Implement a Game Center leaderboard (iOS 7)
I need help with developing Game Center! 我需要开发Game Center的帮助! I found this developer web page http://blog.lucaslouca.com/game-center-leaderboard-ios-7-app/#comment-3761 and need some help with it
我找到了此开发人员网页http://blog.lucaslouca.com/game-center-leaderboard-ios-7-app/#comment-3761,并且需要一些帮助
Here are my questions! 这是我的问题!
Hi, my name is David! 嗨,我叫大卫! I have developed game, it is like flappy bird and I need to implement game center!
我已经开发了游戏,就像飘扬的小鸟,我需要实现游戏中心! I have MyScene.m and MyScene.h, so I understand steps up to 7, but don't know if I should add those three files to my game I am not experienced game developer and need some help.
我有MyScene.m和MyScene.h,所以我了解最多7个步骤,但是不知道是否应该将这三个文件添加到我的游戏中,我不是经验丰富的游戏开发人员,需要一些帮助。 I have few questions: 1) Do I have to add thee three files to my own game in order for game center to work GameCenterManager.h GameCenterManager.m AppSpecificValues.h?
我有几个问题:1)我是否必须将三个文件添加到自己的游戏中才能使游戏中心正常运行GameCenterManager.h GameCenterManager.m AppSpecificValues.h? 2) Where exactly I should put this code?
2)我到底应该把这段代码放在哪里? " // Dummy Highscore NSUInteger _highscore = 1234;
“ // Dummy Highscore NSUInteger _highscore = 1234;
// Sumbit highScore [_gameCenterManager reportScore: _highscore forLeaderboardID:@"1"]; // Sumbit highScore [_gameCenterManager reportScore:_highscore forLeaderboardID:@“ 1”]; "
“
in MyScene.m? 在MyScene.m中? if yes can I put it in -(id)initWithSize:(CGSize)size delegate:(id)delegate state:(GameState)state or in -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event (I have created button for game center and called the method in touches began).
如果是的话,我可以将它放在-(id)initWithSize:(CGSize)size委托:(id)委托状态:(GameState)状态还是-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event(我已经为游戏中心创建了按钮,并开始调用该方法。 3) Where should I put this delegate method - GKGameCenterControllerDelegate (Step 9) in My Scene.m or in View Controller.m?
3)我应该在我的Scene.m或View Controller.m中将此委托方法-GKGameCenterControllerDelegate(第9步)放在哪里? For general info: I have only one UIView Controller in my game which is view controller.
有关常规信息:我的游戏中只有一个UIView Controller,即视图控制器。 the scenes are navigated by "switch" method, each scene is game state something, of example GameStateMainMenue or GameStatePlay and so on.
场景通过“ switch”方法导航,每个场景都是游戏状态,例如GameStateMainMenue或GameStatePlay等。 Thank you for your help!
谢谢您的帮助!
To create the necessary code for a leaderboard see here: Game Center in IOS 7 leaderboard 要为排行榜创建必要的代码,请参见此处: IOS 7排行榜中的Game Center
To authenticate the user you need this code: 要验证用户身份,您需要以下代码:
[[GCHelper sharedGameKitHelper] authenticateLocalPlayer];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.