1

我在回合制游戏应用程序中无法结束回合。

我正在使用的方法是

GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch];

[currentMatch endTurnWithNextParticipants:p turnTimeout:1000 matchData:data completionHandler:^(NSError *error) {
            if (error) {
                NSLog(@"%@", error);
            }
        }];

p是我的 nextParticipants 的 NSArray,这是我的声明:这是声明和分配

NSArray *p = [[currentMatch.participants reverseObjectEnumerator] allObjects];

我正在反转参与者数组以获取玩家的轮流顺序。(只有 2 个)

这一切都编译并运行没有错误,但回合实际上从未传递给其他玩家!

认为我的 p-array 是我尝试通过它而不反转它产生相同结果的问题。

有谁知道处理这个问题的正确方法?

4

1 回答 1

4

将您的代码替换为

GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch];

GKTurnBasedParticipant *nextPerson = [currentMatch.participants objectAtIndex:((currentIndex + 1) % [currentMatch.participants count])];

[currentMatch endTurnWithNextParticipants:[NSArray arrayWithObject:nextPerson] turnTimeout:1000 matchData:matchData completionHandler:^(NSError *error) {
    if (error) {
        NSLog(@"%@", error);
    }
}];
于 2013-12-08T17:57:38.250 回答