Google Play 游戏不允许用户加入回合制比赛

Posted

技术标签:

【中文标题】Google Play 游戏不允许用户加入回合制比赛【英文标题】:Google Play Games not allowing user to join turn-based match 【发布时间】:2014-09-05 03:52:07 【问题描述】:

我创建了一个回合制比赛并继续邀请单个对手,如下所示:

GPGMultiplayerConfig *config = [[GPGMultiplayerConfig alloc] init];
// We will automatically match with one other player
config.invitedPlayerIds = @[self.opponent.googlePlayID];
config.minAutoMatchingPlayers = 0;
config.maxAutoMatchingPlayers = 0;

[GPGTurnBasedMatch
 createMatchWithConfig:config
 completionHandler:^(GPGTurnBasedMatch *match, NSError *error) 
     if (error) 
         completion(NO);
         return;
     
];

在此设备先下手并将下一回合传递给我的对手设备后,我的对手设备会收到加入比赛的推送通知。我通过加入来回应。此时我的self.match.userMatchStatus 为这个受邀设备是invited

[self.match joinWithCompletionHandler:^(NSError *error) 
    if (error) 
        completion(NO);
        return;
    
];

这不会出错。致电self.match.isMyTurn 后,我回复YES。对self.match.userMatchStatus 的调用给出invited 的状态;不是joined。文档(顺便说一句,这非常糟糕)指出这个joinWithCompletionHandler: 方法:

加入玩家受邀参加的回合制比赛。

即使在此之后添加 3 秒的调度时间延迟,为了给它一个机会,我发现它仍然设置为 invited。调用其他方法(例如 takeTurnWithNextParticipantId:data:results:completionHandler:)失败并出现完全未记录的错误:

Error Domain=com.google.GooglePlayGames Code=3 "操作失败 完成。 (com.google.GooglePlayGames 错误 3。)”

这里是 Google 文档的链接:

https://developers.google.com/games/services/ios/api/interface_g_p_g_turn_based_match

【问题讨论】:

我遇到了同样的错误,无法确定是怎么回事,您解决了吗? 【参考方案1】:

我猜你将玩家 ID 而不是参与者 ID 传递给 takeTurnWithNextParticipantId。错误代码 3(和 http 响应代码 400)意味着传递的参数中的某些内容无效,在我的情况下,是我设置错误的参与者 ID。

【讨论】:

以上是关于Google Play 游戏不允许用户加入回合制比赛的主要内容,如果未能解决你的问题,请参考以下文章

Android Google Play 游戏服务回合制多人游戏不自动匹配

带有 Google Play 游戏服务和 IntentService 的回合制安卓游戏

iOS-Google Play 游戏服务的可用性回合制多人游戏

从 Google Play 服务、Unity 插件获取所有回合制比赛信息

带有活动切换的 Google Play 游戏服务多人游戏

Google Play 游戏服务多人游戏和后端