From bddad8667490d94d256f171553f92336ecb509c4 Mon Sep 17 00:00:00 2001 From: Niko Jochim <82joni1bif@hft-stuttgart.de> Date: Thu, 18 Jun 2020 22:53:41 +0200 Subject: [PATCH] review changes --- GoldWars/GoldWars/Components/SliderNode.swift | 4 +-- GoldWars/GoldWars/Entities/Modal.swift | 29 +++++++++---------- GoldWars/GoldWars/Scenes/GameScene.swift | 2 +- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/GoldWars/GoldWars/Components/SliderNode.swift b/GoldWars/GoldWars/Components/SliderNode.swift index 78adda3..6919d20 100644 --- a/GoldWars/GoldWars/Components/SliderNode.swift +++ b/GoldWars/GoldWars/Components/SliderNode.swift @@ -30,8 +30,7 @@ class SliderNode :SKNode { sliderLine.fillColor = SKColor.white sliderLine.zPosition = 4 - - hiddenKnob = SliderKnob(circleOfRadius: 60) + hiddenKnob = SliderKnob(circleOfRadius: 58 ) hiddenKnob.min = position.x - width / 2 hiddenKnob.max = position.x + width / 2 hiddenKnob.fillColor = SKColor.red @@ -52,7 +51,6 @@ class SliderNode :SKNode { fatalError("init(coder:) has not been implemented") } - } class SliderKnob: SKShapeNode { diff --git a/GoldWars/GoldWars/Entities/Modal.swift b/GoldWars/GoldWars/Entities/Modal.swift index 64be9ea..7dcce67 100644 --- a/GoldWars/GoldWars/Entities/Modal.swift +++ b/GoldWars/GoldWars/Entities/Modal.swift @@ -53,11 +53,11 @@ class Modal: GKEntity{ switch modaltype { case .BaseAttack: header = SKLabelNode(text: "Angriff") - body = SKLabelNode(text: "Schicke \(unitCount / 2)\nEinheiten") + body = SKLabelNode(text: "\(unitCount / 2) Einheiten") footer = SKLabelNode() case .BaseMoveOwnUnits: header = SKLabelNode(text: "Formation") - body = SKLabelNode(text: "Sende \(unitCount / 2)\nEinheiten") + body = SKLabelNode(text: "\(unitCount / 2) Einheiten") footer = SKLabelNode() case .PauseGame: header = SKLabelNode(text: "Pause") @@ -70,15 +70,15 @@ class Modal: GKEntity{ self.header.fontName = "HelveticaNeue-Bold" self.header.fontSize = 40 self.header.zPosition = 5 - - self.body.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 20) + + self.body.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y + 15) self.body.numberOfLines = 2 self.body.preferredMaxLayoutWidth = 390 self.body.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.center self.body.fontName = "HelveticaNeue-Bold" self.body.fontSize = 40 self.body.zPosition = 5 - + self.footer.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 40) self.footer.fontName = "HelveticaNeue-Bold" self.footer.fontSize = 40 @@ -86,17 +86,14 @@ class Modal: GKEntity{ super.init() - switch modaltype{ - case .BaseAttack, .BaseMoveOwnUnits: - let text = (modaltype == .BaseAttack) ? "Angriff" : "Senden" - addComponent(SliderComponent(width: 300, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 50))) - addComponent(ButtonComponent(textureName: "yellow_button04", text: text, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 105), isEnabled: true, onButtonPress: { - self.sendUnits(currentDraggedBase: currentDraggedBase, touchLocation: touchLocation!, gameScene: gameScene, collisionBase: collisionBase) - EntityManager.gameEMInstance.removeModal() - })) - default: - break - } + + let text = (modaltype == .BaseAttack) ? "Angriff" : "Senden" + addComponent(SliderComponent(width: 300, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 15))) + addComponent(ButtonComponent(textureName: "yellow_button04", text: text, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 95), isEnabled: true, onButtonPress: { + self.sendUnits(currentDraggedBase: currentDraggedBase, touchLocation: touchLocation!, gameScene: gameScene, collisionBase: collisionBase) + EntityManager.gameEMInstance.removeModal() + })) + } required init?(coder: NSCoder) { diff --git a/GoldWars/GoldWars/Scenes/GameScene.swift b/GoldWars/GoldWars/Scenes/GameScene.swift index 5d1105b..812e3fc 100644 --- a/GoldWars/GoldWars/Scenes/GameScene.swift +++ b/GoldWars/GoldWars/Scenes/GameScene.swift @@ -120,7 +120,7 @@ class GameScene: SKScene{ } else if Int(GameScene.sendUnits) == currentDraggedBase?.unitCount { GameScene.sendUnits -= 1 } - modal.body.text = "Schicke \(GameScene.sendUnits) Einheiten " + modal.body.text = "\(GameScene.sendUnits) Einheiten " } } }