diff --git a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base-1.png b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base-1.png deleted file mode 100644 index efa12ed..0000000 Binary files a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base-1.png and /dev/null differ diff --git a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base-2.png b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base-2.png deleted file mode 100644 index efa12ed..0000000 Binary files a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base-2.png and /dev/null differ diff --git a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base.png b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base.png deleted file mode 100644 index efa12ed..0000000 Binary files a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Base.png and /dev/null differ diff --git a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-1.png b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-1.png new file mode 100644 index 0000000..b64e89c Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-1.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-2.png b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-2.png new file mode 100644 index 0000000..b64e89c Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture-2.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture.png b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture.png new file mode 100644 index 0000000..b64e89c Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/BaseTexture.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Contents.json index a4fdd66..b8c21ef 100644 --- a/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Contents.json +++ b/GoldWars/GoldWars/Assets.xcassets/BaseTexture.imageset/Contents.json @@ -1,17 +1,17 @@ { "images" : [ { - "filename" : "Base.png", + "filename" : "BaseTexture.png", "idiom" : "universal", "scale" : "1x" }, { - "filename" : "Base-1.png", + "filename" : "BaseTexture-1.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "Base-2.png", + "filename" : "BaseTexture-2.png", "idiom" : "universal", "scale" : "3x" } diff --git a/GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/Contents.json new file mode 100644 index 0000000..7b1399e --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "exitButton.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/exitButton.png b/GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/exitButton.png new file mode 100644 index 0000000..7d180b7 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/exitButton.imageset/exitButton.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/Contents.json new file mode 100644 index 0000000..6b9729c --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "finish_button 2.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/finish_button 2.png b/GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/finish_button 2.png new file mode 100644 index 0000000..00c4273 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/finish_button.imageset/finish_button 2.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/Contents.json index eb589c3..935a821 100644 --- a/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/Contents.json +++ b/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "gold_button_3.png", + "filename" : "gold_button_4.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/gold_button_3.png b/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/gold_button_3.png deleted file mode 100644 index ca585e9..0000000 Binary files a/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/gold_button_3.png and /dev/null differ diff --git a/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/gold_button_4.png b/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/gold_button_4.png new file mode 100644 index 0000000..bce5294 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/gold_button_3.imageset/gold_button_4.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/Contents.json new file mode 100644 index 0000000..935a821 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "gold_button_4.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/gold_button_4.png b/GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/gold_button_4.png new file mode 100644 index 0000000..f225057 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/gold_button_4.imageset/gold_button_4.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/Contents.json new file mode 100644 index 0000000..bdb389d --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "roundInfoTexture.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "roundInfoTexture-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "roundInfoTexture-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-1.png b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-1.png new file mode 100644 index 0000000..49b79a3 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-1.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-2.png b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-2.png new file mode 100644 index 0000000..49b79a3 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture-2.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture.png b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture.png new file mode 100644 index 0000000..49b79a3 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/roundInfoTexture.imageset/roundInfoTexture.png differ diff --git a/GoldWars/GoldWars/Components/SkillButtonNode.swift b/GoldWars/GoldWars/Components/SkillButtonNode.swift index 069b9d5..3c8e9f2 100644 --- a/GoldWars/GoldWars/Components/SkillButtonNode.swift +++ b/GoldWars/GoldWars/Components/SkillButtonNode.swift @@ -20,6 +20,8 @@ class SkillButtonNode: ButtonNode { self.cooldown = cooldown self.displayText = text super.init(textureName: textureName, text: text, isEnabled: isEnabled, position: position, onButtonPress: onButtonPress) + self.size = CGSize(width: 100, height: 100) + self.label.fontSize = 25 } diff --git a/GoldWars/GoldWars/Entities/HUD.swift b/GoldWars/GoldWars/Entities/HUD.swift index 070e857..a66fdc6 100644 --- a/GoldWars/GoldWars/Entities/HUD.swift +++ b/GoldWars/GoldWars/Entities/HUD.swift @@ -51,31 +51,27 @@ class HUD: GKEntity { roundTimerLabel.horizontalAlignmentMode = .center self.roundTimer = RoundTimer() - - leaveGame = ButtonNode(textureName: "yellow_button04", text: "Verlassen" , isEnabled: true, position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.17, y: EntityManager.gameEMInstance.scene.size.height * 0.04), onButtonPress: { + + finishButton = SingeClickButtonNode( + textureName: "finish_button", + text: "", + isEnabled: true, + position: CGPoint( + x: EntityManager.gameEMInstance.scene.size.width * 0.95 , + 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: { 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.setScale(0.6) - - spySkill = SkillButtonNode( - textureName: "spy_button", - text: "Spy", - isEnabled: true, - cooldown: 3, - position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.80, y: EntityManager.gameEMInstance.scene.size.height * 0.1), - onButtonPress: { - EntityManager.gameEMInstance.getOpponentBases(for: EntityManager.gameEMInstance.getTeam()).forEach({base in base.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(base.unitCount)"}) - GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100) - GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.spy.ten", increasePercentComplete: 10) - SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0) - } - ) + leaveGame.size = CGSize(width: 120, height: 120); + defSkill = SkillButtonNode( textureName: "def_button", text: "Def", isEnabled: true, cooldown: 4, - position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.90, y: EntityManager.gameEMInstance.scene.size.height * 0.1), + position: CGPoint(x: finishButton.position.x - 85, y: finishButton.position.y), onButtonPress: { DataService.sharedInstance.localRoundData.hasDefenceBoost = true GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100) @@ -83,12 +79,25 @@ class HUD: GKEntity { SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0) } ) + spySkill = SkillButtonNode( + textureName: "spy_button", + text: "Spy", + isEnabled: true, + cooldown: 3, + position: CGPoint(x: defSkill.position.x - 85, y: defSkill.position.y), + onButtonPress: { + EntityManager.gameEMInstance.getOpponentBases(for: EntityManager.gameEMInstance.getTeam()).forEach({base in base.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(base.unitCount)"}) + GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100) + GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.spy.ten", increasePercentComplete: 10) + SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0) + } + ) atkSkill = SkillButtonNode( textureName: "atk_button", text: "Atk", isEnabled: true, cooldown: 4, - position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.70, y: EntityManager.gameEMInstance.scene.size.height * 0.1), + position: CGPoint(x: spySkill.position.x - 85, y: spySkill.position.y), onButtonPress: { DataService.sharedInstance.localRoundData.hasAttackBoost = true GameCenterManager.sharedInstance.addAchievementProgress(identifier: "de.hft.stuttgart.ip2.goldwars.skill.first.time", increasePercentComplete: 100) @@ -96,21 +105,10 @@ class HUD: GKEntity { SoundManager.sharedInstance.playSoundEffect(pathToFile: "use_boost",fileExtension: "wav",volumeLevel: 0.0) } ) - - finishButton = SingeClickButtonNode( - textureName: "yellow_button04", - text: "Fertig", - isEnabled: true, - position: CGPoint( - x: EntityManager.gameEMInstance.scene.size.width * 0.17, - y: EntityManager.gameEMInstance.scene.size.height * 0.09), - onButtonPress: { } - ) - finishButton.size = CGSize(width: 125, height: 40) - finishButton.setScale(0.9) + finishButton.size = CGSize(width: 100, height: 100) finishButton.zPosition = 2 - backgroundRoundCounter = SKSpriteNode(texture: SKTexture(imageNamed: "roundInfo_texture")) + backgroundRoundCounter = SKSpriteNode(texture: SKTexture(imageNamed: "roundInfoTexture")) currentRoundLabel = SKLabelNode(fontNamed: "Courier-Bold") roundsLabel = SKLabelNode(fontNamed: "Courier-Bold") roundLabel = SKLabelNode(fontNamed: "Courier-Bold") @@ -121,7 +119,6 @@ class HUD: GKEntity { blockWholeScreenPane.isHidden = true super.init() initRoundInfo(size: size) - finishButton.onButtonPress = { [unowned self] in self.finishRound() } @@ -133,7 +130,6 @@ class HUD: GKEntity { hostUnitsLabel.position = CGPoint(x: size.width * 0.05, y: size.height * 0.9) peerUnitsLabel.position = CGPoint(x: size.width * 0.95, y: size.height * 0.9) setColor(labelNodes: [hostLabel,hostUnitsLabel,peerLabel,peerUnitsLabel]) - roundTimer.initTimer() startWithDuration() } @@ -169,13 +165,13 @@ class HUD: GKEntity { func initRoundInfo(size: CGSize) -> () { backgroundRoundCounter.zPosition = 2 - backgroundRoundCounter.position = CGPoint(x: Double(size.width) * 0.06, y: Double(size.height) * 0.08) - + backgroundRoundCounter.position = CGPoint(x: leaveGame.position.x + 63, y: leaveGame.position.y) + backgroundRoundCounter.size = CGSize(width: 120, height: 120) currentRoundLabel.text = "\(RoundCalculatorService.sharedInstance.currentRound)" currentRoundLabel.fontSize = 50 currentRoundLabel.fontColor = SKColor.black currentRoundLabel.verticalAlignmentMode = .center - currentRoundLabel.position = CGPoint(x: backgroundRoundCounter.position.x, y: backgroundRoundCounter.position.y - 5) + currentRoundLabel.position = CGPoint(x: backgroundRoundCounter.position.x, y: backgroundRoundCounter.position.y - 4) currentRoundLabel.zPosition = backgroundRoundCounter.zPosition + 1 roundsLabel.zPosition = backgroundRoundCounter.zPosition + 1 diff --git a/GoldWars/GoldWars/Scenes/GameScene.swift b/GoldWars/GoldWars/Scenes/GameScene.swift index 6acdaf1..93d4548 100644 --- a/GoldWars/GoldWars/Scenes/GameScene.swift +++ b/GoldWars/GoldWars/Scenes/GameScene.swift @@ -153,8 +153,8 @@ class GameScene: SKScene{ let action = SKAction.afterDelay(2) { (self.childNode(withName: "hostLabel") as! SKLabelNode).horizontalAlignmentMode = .center (self.childNode(withName: "peerLabel") as! SKLabelNode).horizontalAlignmentMode = .center - self.childNode(withName: "hostLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.3), duration: 1)) - self.childNode(withName: "peerLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.3), duration: 1)) + self.childNode(withName: "hostLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.25), duration: 1)) + self.childNode(withName: "peerLabel")?.run(SKAction.move(to: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.25), duration: 1)) self.initGameEndIcons() let node = ButtonNode(textureName: "yellow_button05", text: "MenĂ¼", isEnabled: true, position: CGPoint(x: self.size.width / 2, y: self.size.height / 2 - 300), onButtonPress: { self.backToMenuAction() @@ -336,16 +336,18 @@ class GameScene: SKScene{ @objc func pauseGame() -> Void { - entityManager.removeModal() - entityManager.getHUD()?.roundTimer.stopTimer() - entityManager.add(Modal(modaltype: .PauseGame, - base: nil, - anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), - gameScene: self, - currentDraggedBase: nil, - touchLocation: nil, - collisionBase: nil - )) + if !self.gameEndEffects{ + entityManager.removeModal() + entityManager.getHUD()?.roundTimer.stopTimer() + entityManager.add(Modal(modaltype: .PauseGame, + base: nil, + anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), + gameScene: self, + currentDraggedBase: nil, + touchLocation: nil, + collisionBase: nil + )) + } } @objc func resumeGame() -> Void {