0

GameCenter から取得したデータを使用して、独自のスキンを作成することはできますか?

もしそうなら、私たちが受け取ったすべてのデータにどこからアクセスできますか? 私が必要とする重要なデータは現在の試合です。他のすべては私にとって大したことではありません。誰か助けてくれませんか?!

4

1 に答える 1

1

これらはあなたを動かすはずです:

[GKTurnBasedMatch loadMatchesWithCompletionHandler:(void (^)(NSArray *matches, NSError *error))completionHandler];

[GKTurnBasedMatch loadMatchDataWithCompletionHandler:(void (^)(NSData *matchData, NSError *error))completionHandler];

編集:

プロセス全体を段階的に説明すると非常に長い投稿になりますが、主なアイデアは次のとおりです。

[GKTurnBasedMatch loadMatchesWithCompletionHandler:(void (^)(NSArray *matches, NSError *error)){ 

for (GKTurnBasedMatch *myMatch in matches) {

// update your UI depending on the games. Below is just an example.. This part is up to you - update a tableView, manage a view etc..

int k = 0; // will hold the number of active players still in the game
for (GKTurnBasedParticipant *part in myMatch.participants) {

if(participant.matchOutcome != GKTurnBasedMatchOutcomeQuit){
k++;
}

}

if ([myMatch.currentParticipant.playerID isEqualToString [GKPlayer localPlayer].playerID]) {
//our turn

if (k<2) { //there are less than 2 active players - end game if it's your turn etc...

//end turn depending on your turn.
return;
}

//update your UI for that match..


} else { //not your turn

//update your UI - goes to their turn section for example

}

}


}];

繰り返しますが、私は頭のてっぺんからこれらすべてを書いたので、間違いがあると確信していますが、それがあなたが取りたい主なルートです. あなたは現在の試合のリストを取得したいと考えています - そして、誰のターンであるか、ゲームが終了したかどうかなどに応じてそれらをリストします。

于 2012-06-01T21:08:08.157 に答える