This commit is contained in:
Ömer Özel 2020-05-05 00:35:27 +02:00 committed by Ömer Özel
parent e1d5af8a4a
commit b8b37de349
2 changed files with 14 additions and 10 deletions

View File

@ -40,8 +40,8 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
super.init()
}
func presentMatchmaker() {
// menusc = scene
func presentMatchmaker(scene: MenuScene) {
menusc = scene
print("I'm in 43")
guard GKLocalPlayer.local.isAuthenticated else {
print("Player ist nicht authentifiziert")
@ -110,10 +110,11 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
if mpMatch != match { return }
// delegate?.matchReceivedData(match: match, data: data, fromPlayer:
// playerID)
}
private func match(match: GKMatch!, didFailWithError error: NSError!) {
print("I'm in 113")
print("Cant connect to any other player")
if mpMatch != match {
return
}
@ -160,8 +161,10 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
self.serverPlayer = player
}
self.delegate?.matchStarted()
// self.menusc!.loadScene(scene: GameScene(size: self.menusc!.size))
/// self.delegate?.matchStarted()
print("spiel gefunden")
self.menusc!.loadScene(scene: GameScene(size: self.menusc!.size))
print("scene müsste gewechselt sein")
})
}

View File

@ -21,7 +21,9 @@ class MenuScene: SKScene {
text: "Start Game",
position: CGPoint(x: midX, y: midY),
onButtonPress: {
MatchmakingHelper.sharedInstance.presentMatchmaker()
//let mmh = MatchmakingHelper()
//mmh.delegate = self
MatchmakingHelper.sharedInstance.presentMatchmaker(scene: self)
}))
entityManager.add(Button(name: "settingsButton",
iconName: "",
@ -47,10 +49,9 @@ class MenuScene: SKScene {
}
extension MenuScene: GameKitHelperDelegate{
func matchStarted() {
print("Spiel gestartet")
}
func matchStarted() {
print("halo i bims")
self.loadScene(scene: GameScene(size: self.size))
}
}