我在iOS游戏中心创建了一个回合制游戏,游戏运行良好,数据在玩家之间正确传递。
我想知道:
你怎么能排除一个在另一个之前输掉的球员?
我在任何地方都找不到参考 我该怎么走?
提前感谢,对不起我的英语
安杰洛
编辑:
好的,我试过了,它成功了(被排除的玩家也可以查看比赛)
//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) {
[…]
}];