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() super.init()
} }
func presentMatchmaker() { func presentMatchmaker(scene: MenuScene) {
// menusc = scene menusc = scene
print("I'm in 43") print("I'm in 43")
guard GKLocalPlayer.local.isAuthenticated else { guard GKLocalPlayer.local.isAuthenticated else {
print("Player ist nicht authentifiziert") print("Player ist nicht authentifiziert")
@ -110,10 +110,11 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
if mpMatch != match { return } if mpMatch != match { return }
// delegate?.matchReceivedData(match: match, data: data, fromPlayer: // delegate?.matchReceivedData(match: match, data: data, fromPlayer:
// playerID) // playerID)
} }
private func match(match: GKMatch!, didFailWithError error: NSError!) { private func match(match: GKMatch!, didFailWithError error: NSError!) {
print("I'm in 113") print("Cant connect to any other player")
if mpMatch != match { if mpMatch != match {
return return
} }
@ -160,8 +161,10 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
self.serverPlayer = player self.serverPlayer = player
} }
self.delegate?.matchStarted() /// self.delegate?.matchStarted()
// self.menusc!.loadScene(scene: GameScene(size: self.menusc!.size)) 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", text: "Start Game",
position: CGPoint(x: midX, y: midY), position: CGPoint(x: midX, y: midY),
onButtonPress: { onButtonPress: {
MatchmakingHelper.sharedInstance.presentMatchmaker() //let mmh = MatchmakingHelper()
//mmh.delegate = self
MatchmakingHelper.sharedInstance.presentMatchmaker(scene: self)
})) }))
entityManager.add(Button(name: "settingsButton", entityManager.add(Button(name: "settingsButton",
iconName: "", iconName: "",
@ -47,10 +49,9 @@ class MenuScene: SKScene {
} }
extension MenuScene: GameKitHelperDelegate{ extension MenuScene: GameKitHelperDelegate{
func matchStarted() {
print("Spiel gestartet")
}
func matchStarted() {
print("halo i bims")
self.loadScene(scene: GameScene(size: self.size))
}
} }