FIX trigger GameQuit

This commit is contained in:
Niko Jochim 2020-07-02 12:53:45 +02:00
parent 5d8df46361
commit 985e4f48cb
3 changed files with 7 additions and 1 deletions

View File

@ -61,7 +61,11 @@ class HUD: GKEntity {
y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: { }
)
leaveGame = ButtonNode(textureName: "exitButton", text: "" , isEnabled: true, position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.05, y: EntityManager.gameEMInstance.scene.size.height * 0.11), onButtonPress: {
leaveGame = ButtonNode(textureName: "exitButton",
text: "" ,
isEnabled: true,
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.05, y: EntityManager.gameEMInstance.scene.size.height * 0.11),
onButtonPress: {
EntityManager.gameEMInstance.add(Modal(modaltype: .QuitGame, base: nil, anchorPoint: CGPoint(x: EntityManager.gameEMInstance.scene.size.width / 2 , y: EntityManager.gameEMInstance.scene.size.height / 2), gameScene: EntityManager.gameEMInstance.scene, currentDraggedBase: nil, touchLocation: nil, collisionBase: nil))
})
leaveGame.size = CGSize(width: 120, height: 120);

View File

@ -105,6 +105,7 @@ class Modal: GKEntity{
GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 6))
GameCenterManager.sharedInstance.opponentQuit = false
GameCenterManager.sharedInstance.quitGame = true
(EntityManager.gameEMInstance.scene as! GameScene).gameQuit()
}))
case .PauseGame:
break

View File

@ -178,6 +178,7 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
(EntityManager.gameEMInstance.scene as! GameScene).gameEnd()
case 6:
os_log("State 6 erhalten, Peer hat Spiel verlassen ", log: LOG, type: .info)
(EntityManager.gameEMInstance.scene as! GameScene).gameQuit()
opponentQuit = true
quitGame = true
default: