在 GKTurnBasedMatch 中更新比赛数据而不结束回合

发布于 2024-12-20 11:34:58 字数 147 浏览 5 评论 0原文

似乎 GameKit 只允许每次从 Game Center 服务器加载 GKTurnBasedMatch 时更新一次 GKTurnBasedMatch。还有其他方法可以更新 matchData 属性吗?

It seems that GameKit only allows GKTurnBasedMatch to be updated once per time that GKTurnBasedMatch is loaded from the Game Center servers. Is there an other way to update the matchData property?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无远思近则忧 2024-12-27 11:34:58

您可以

[GKTurnBasedMatch (void)loadMatchDataWithCompletionHandler:(void (^)(NSData *matchData, NSError *error))completionHandler];

根据需要多次调用 `- 来获取更新的 matchData。
如果您想做增量移动,您也可以这样做 -

[GKTunrBasedMatch - (void)endTurnWithNextParticipant:(GKTurnBasedParticipant *)nextParticipant matchData:(NSData *)matchData completionHandler:(void (^)(NSError *error))completionHandler];

将您自己的参与者作为下一个参与者。但是,您必须在提交部分移动后再次 loadMatchDataWithCompletionhandler: ,然后才能提交下一个移动部分。

You can call `-

[GKTurnBasedMatch (void)loadMatchDataWithCompletionHandler:(void (^)(NSData *matchData, NSError *error))completionHandler];

as often as you like to get updated matchData.
If you want to do incremental moves you also can do -

[GKTunrBasedMatch - (void)endTurnWithNextParticipant:(GKTurnBasedParticipant *)nextParticipant matchData:(NSData *)matchData completionHandler:(void (^)(NSError *error))completionHandler];

with your own participant as next participant. However, you have to loadMatchDataWithCompletionhandler: once again after you submitted your partial move before you are allowed to submit the next move part.

小兔几 2024-12-27 11:34:58

以下方法已添加到 iOS 6.0 中的 GKTurnBasedMatch 中,并将执行您需要的操作:

- (void)saveCurrentTurnWithMatchData:(NSData *)matchData
                   completionHandler:(void (^)(NSError *error))completionHandler

“更新比赛数据,而不将游戏推进到其他玩家”

The following method was added to GKTurnBasedMatch in iOS 6.0 and will do what you need:

- (void)saveCurrentTurnWithMatchData:(NSData *)matchData
                   completionHandler:(void (^)(NSError *error))completionHandler

"Update the match data without advancing the game to another player"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文