diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/Contents.json index e5d476d..9d86df1 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/Contents.json +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "board.png", + "filename" : "Group 1-2.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/Group 1-2.png b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/Group 1-2.png new file mode 100644 index 0000000..570bb75 Binary files /dev/null and b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/Group 1-2.png differ diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/board.png b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/board.png deleted file mode 100644 index faea3d9..0000000 Binary files a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/board.imageset/board.png and /dev/null differ diff --git a/ArkitDoushiQi/ArkitDoushiQi/Game/GameScene.swift b/ArkitDoushiQi/ArkitDoushiQi/Game/GameScene.swift index 5e7ed5a..a062f50 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Game/GameScene.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Game/GameScene.swift @@ -11,6 +11,7 @@ import DouShouQiModel class GameScene : SKScene { + var isGameOver = false let imageBoard:SKSpriteNode = SKSpriteNode(imageNamed: "board") var game:Game = try! Game(withRules: ClassicRules(), andPlayer1: HumanPlayer(withName: "Bot1", andId: .player1)!, andPlayer2: RandomPlayer(withName: "Bot2", andId: .player2)!) diff --git a/ArkitDoushiQi/ArkitDoushiQi/Game/GameView.swift b/ArkitDoushiQi/ArkitDoushiQi/Game/GameView.swift index e4b3db4..91b3503 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Game/GameView.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Game/GameView.swift @@ -67,7 +67,8 @@ struct GameView: View { default: msg="Game over !" } -// foreach gameScene.pieces + + gameScene.isGameOver = true actionEndGame(scene: gameScene,message: msg) } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Game/SKNodes/SpriteMoople.swift b/ArkitDoushiQi/ArkitDoushiQi/Game/SKNodes/SpriteMoople.swift index a566948..8069c17 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Game/SKNodes/SpriteMoople.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Game/SKNodes/SpriteMoople.swift @@ -38,12 +38,12 @@ class SpriteMoople : SKNode { override var isUserInteractionEnabled: Bool { - get { return true } - set {} - } + get { return refGameScene?.isGameOver == false } + set { } + } override func touchesBegan(_ touches: Set, with event: UIEvent?) { - + if isUserInteractionEnabled == false { return } let movePoss: [ Move ] = refGameScene!.game.rules.getMoves(in: refGameScene!.game.board,of:refGameScene!.game.rules.getNextPlayer(),fromRow: Int(self.cellPosition.x),andColumn: Int(self.cellPosition.y)) for pos in movePoss { let rect = SKShapeNode(rectOf: CGSize(width: 90, height: 90)) @@ -56,10 +56,12 @@ class SpriteMoople : SKNode { } override func touchesMoved(_ touches: Set, with event: UIEvent?) { + if isUserInteractionEnabled == false { return } self.position = touches.first?.location(in: parent!) ?? CGPoint(x: 0, y: 0) } override func touchesEnded(_ touches: Set, with event: UIEvent?) { + if isUserInteractionEnabled == false { return } let localisation = touches.first?.location(in: parent!) // Clean rect