2014-12-20 68 views
0

我剛剛問過Google Play服務的這個問題,但我也有一個適用於iOS的遊戲中心實施。我的遊戲有兩種模式 - 正常和困難。在比賽結束時,我希望能夠顯示當前模式的排行榜,而不是顯示所有排行榜 - 這將是一個混亂的混亂。 Game Center有可能嗎?遊戲中心 - 顯示一組排行榜

+1

代替我的回答最好看看你的文檔或一個蘋果的例子,因爲他們去通過它AB我正要給你B,因爲你沒有提供任何代碼。無論如何,這是一個很好的起點https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/LeaderBoards/LeaderBoards.html#//apple_ref/doc/uid/TP40008304-CH6-SW44 – soulshined

回答

0

正如@soulshined所提到的,您需要首先查看Game Center編程指南中的文檔,特別是Displaying the Standard Leaderboard的部分。它會解釋得比這裏的簡短答案好得多。

基本上,你首先會創建一個GKGameCenterViewController的實例,告訴它你想顯示一個排行榜,然後指定顯示哪個排行榜,並最終將新的視圖控制器呈現給用戶。像這樣(基於蘋果有些扭捏的示例代碼):

- (void) showLeaderboard: (NSString*) leaderboardID 
{ 
    GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init]; 
    if (gameCenterController != nil) 
    { 
     gameCenterController.gameCenterDelegate = self; 
     gameCenterController.viewState = GKGameCenterViewControllerStateLeaderboards; 
     gameCenterController.leaderboardIdentifier = leaderboardID; 
     [self presentViewController: gameCenterController animated: YES completion:nil]; 
    } 
} 
相關問題