- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我是 Game Center 的新手,我已经设法邀请 friend 并成功打开了按钮的 IBAction。
我正在使用 GKTurnbasedMatch 来管理回合,但对于多人游戏,如何向邀请玩家选择其类别的所有玩家显示卡片。
我怎样才能得到这个?
最佳答案
这是有关 Gamecenter/回合制的精彩教程:
http://www.raywenderlich.com/5509/beginning-turn-based-gaming-with-ios-5-part-2
特别是这部分:
If we find that lastTurn is null, we’ll assume that we’re dealing with a new match, otherwise we’ll assume that we already have matchData that we’ll be dealing with. So open up GCTurnBasedMatchHelper.m and replace the didFindMatch method as follows:
-(void)turnBasedMatchmakerViewController:
(GKTurnBasedMatchmakerViewController *)viewController
didFindMatch:(GKTurnBasedMatch *)match {
[presentingViewController
dismissModalViewControllerAnimated:YES];
self.currentMatch = match;
GKTurnBasedParticipant *firstParticipant =
[match.participants objectAtIndex:0];
if (firstParticipant.lastTurnDate) {
NSLog(@"existing Match");
} else {
NSLog(@"new Match");
}
}
您要做的是每轮将所有数据发送给所有玩家,因此当玩家第一次开始(发牌)时,他们应该将手牌发送给所有玩家。当他们不交易时,您不必发送所有数据,因此您可以发送不同类型的消息。发送信息:
BOOL success = [[GameCenterManager sharedInstance].Match sendDataToAllPlayers:data withDataMode:GKMatchSendDataReliable error:&error];
只要确保数据有类型,这通常是消息的第一个字节,然后在客户端,读取第一个字节以确定它是什么类型的消息,然后使用 switch 语句或任何你喜欢处理不同类型的消息。
关于iphone - 使用游戏中心向所有玩家显示相同的牌,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13656635/
这个问题在这里已经有了答案: What does the question mark character ('?') mean in C++? (8 个答案) 关闭 7 年前。 这一行我看不懂为什么
在构建模式下甚至可以有两个玩家吗?查看 Roblox 开发者杂志文章“What did you sleigh?”,它在玩家列表中显示了两个“玩家”。 最佳答案 打开 Roblox Studio 转到任
在构建模式下甚至可以有两个玩家吗?查看 Roblox 开发者杂志文章“What did you sleigh?”,它在玩家列表中显示了两个“玩家”。 最佳答案 打开 Roblox Studio 转到任
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 5 年前。 Improve this qu
“Clash of Clans”使用 Game Center 对玩家进行身份验证并将其与现有的远程存储游戏状态相关联。 据我所知,游戏仅在客户端提供玩家标识符。是否有支持的技术来安全地验证用户而不是仅
我正在开发多人游戏,但我无法找出如何将其他客户端连接到创建的游戏。我的意思是客户端 A 创建到服务器的套接字连接,其他客户端(A,B ...)如何连接到客户端 A?有人可以帮我吗? 附注我是网络编程新
我正在尝试使用浏览器控制台一步一步地制作井字游戏,并最终改进我的功能。然而,我被困在玩家2回合(ttt_player2_turn()),我必须检查箱子是否为空。看来我在这个例子中的论证有问题。感谢您的
如果我向上移动玩家 1 和玩家 2,假设我按下玩家 1 的向下键,我的玩家将停止向上移动。我找不到问题所在。有人可以帮助我并解释我做错了什么吗? package game; import java.a
我正在创建一个自上而下的 2D 游戏,并且使用 Box2D 来模拟物理,我的问题是: 如何使玩家保持与我的宇宙飞船的相对速度,并且仍然能够在飞船也在移动的情况下围绕我的玩家移动? 我在下面放了一个插图
我是 Java 新手,我正在尝试制作一个简单的游戏来娱乐。我首先尝试将 repaint 放入 PaintComponent() 中,它一直有效,直到我尝试添加一些背景。有谁知道如何让我的玩家在有或没有
//我正在尝试对玩家 2 的代码进行一些编辑,因此我删除了涉及玩家 1 的所有内容。但出于某种原因,如果没有玩家 1 的代码,玩家 2 根本不会执行任何操作。(假设使用 i、j、k 和 l 键 mov
我接到了一项任务,要编写一个由人类玩家和 AI 玩家组成的 NIM 游戏。游戏是“Misere”(最后一个必须拿起一根棍子的人输了)。 AI 应该使用 Minimax 算法,但它正在采取使其输得更快的
我是一名优秀的程序员,十分优秀!