1

我发起一个这样的在线游戏:

    request = [[[GKMatchRequest alloc] init] autorelease];
    request.minPlayers = 2;
    request.maxPlayers = 2;
    mmvc = [[[GKMatchmakerViewController alloc] initWithMatchRequest:request] autorelease];

当我收到委托方法时:

    - (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)match

如何知道玩家是选择了自动匹配还是邀请了朋友。

感谢提前。

4

1 回答 1

0

我认为您当时无法分辨,但您可以将发生的事情存储在您的邀请处理程序中,例如:

    [GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite *acceptedInvite, NSArray *playersToInvite) {    
            if (acceptedInvite){
               // this player has accepted an invite
               acceptedInvite = YES;
               ....
            } else if (playersToInvite) {
               // this player is making an invite
              sentInvite = YES
              ...
            }
        };

如果这些变量都没有设置为 YES 我想你可以假设它是一个自动匹配。请记住在游戏中适当的地方将两者都设置为 NO。

于 2011-05-19T19:44:16.270 回答