游戏中心主机
我目前正在创建一个 Game Center 游戏,并使用可用的点对点功能。但是,我想选择其中一名玩家(2名玩家)作为主机,以确保同步。
从可用的玩家中选择主机(甚至是随机的)并确保其他设备知道选择了哪个主机的最佳方法是什么?
I am currently creating a Game Center game, and am using the peer-to-peer functionality available. However, I would like to select one of the players (2 players) to act as a host, to ensure synchronization.
What is the best way to select a host (even randomly) from the players available and ensure that the other device knows which host was chosen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个 是一个很好、简单的教程,其中的代码演示了如何执行此操作。他们随机选择一位同伴作为主持人。希望有帮助!
This is a nice, simple tutorial with code that demonstrates how to do this. They randomly choose one of the peers to be the host. Hope that Helps!
执行该操作的示例代码
已经发布了答案,这里仍然是现在在委托函数中
already posted answer , still here is sample code to do that thing
now in delegate Function