Ios8 游戏中心配对

Ios8 游戏中心配对,ios8,game-center,gkmatchmaker,Ios8,Game Center,Gkmatchmaker,我需要匹配3名玩家,1名巫师和2名战士作为属性。用GKMatch怎么办?下面的代码片段来自我的代码 var wizard = true enum Role : UInt32 { case wizard = 0xffff0000 case warrior = 0x0000ffff } let matchRequest = GKMatchRequest() matchRequest

我需要匹配3名玩家,1名巫师和2名战士作为属性。用GKMatch怎么办?下面的代码片段来自我的代码

    var wizard = true       
    enum Role : UInt32 {
            case wizard = 0xffff0000
            case warrior = 0x0000ffff
        }

    let matchRequest = GKMatchRequest()
        matchRequest.minPlayers = 3
        matchRequest.maxPlayers = 3
        matchRequest.playerAttributes = wizard ? Role.wizard.rawValue : Role.warrior.rawValue

   let matchMakerViewController = GKMatchmakerViewController(matchRequest: matchRequest)
        matchMakerViewController.matchmakerDelegate = self
        presentingViewController?.presentViewController(matchMakerViewController, animated: false, completion:nil)
设置两个玩家,一个巫师和一个战士,一切都很好,但我需要两个战士的比赛


提前谢谢你

你能定义3个角色吗?例如:

case wizard   = 0xffff0000
case warrior1 = 0x0000ff00
case warrior2 = 0x000000ff

你需要在两种战士类型(“红色”战士和“蓝色”战士)之间做一些细微的区分,或者随机为每个战士玩家分配类型1或类型2。

我解决了这个问题。解决方案是将战士设置为0xfffffff

谢谢你的回复,但这不适用于我的情况,因为游戏中的两个战士是完全平等的。