私はiOSゲームセンターでゲームターンベースを作成しました。ゲームはうまく機能し、データはプレーヤーからプレーヤーに適切に渡されます。
知りたかった:
他のプレイヤーより先に負けたプレイヤーをどのように除外できますか?
どこにも参照が見つかりませんどうすればいいですか?
よろしくお願いします。英語でごめんなさい
アンジェロ
編集:
OK、これを試してみましたが、うまくいきました(除外されたプレイヤーも試合を見ることができます)
//When current player is excluded
GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch];
currentMatch.currentParticipant.matchOutcome == GKTurnBasedMatchOutcomeQuit
//FOR SEND TURN :
NSUInteger currentIndex = [currentMatch.participants indexOfObject:currentMatch.currentParticipant];
GKTurnBasedParticipant *nextParticipant;
NSUInteger nextIndex = (currentIndex + 1) % [currentMatch.participants count];
nextParticipant = [currentMatch.participants objectAtIndex:nextIndex];
for (int i = 0; i < [currentMatch.participants count]; i++) {
nextParticipant = [currentMatch.participants objectAtIndex:((currentIndex + 1 + i) % [currentMatch.participants count ])];
if (nextParticipant.matchOutcome != GKTurnBasedMatchOutcomeQuit) {
///prossimo giocatore che NON è stato escluso
break;
} else {
/////Prossimo giocatore perché questo è stato escluso
}
}
[currentMatch endTurnWithNextParticipant:nextParticipant matchData:data completionHandler:^(NSError *error) {
[…]
}];