diff --git a/GoldWars/GoldWars/Components/SliderComponent.swift b/GoldWars/GoldWars/Components/SliderComponent.swift index 7f3a15f..e681e70 100644 --- a/GoldWars/GoldWars/Components/SliderComponent.swift +++ b/GoldWars/GoldWars/Components/SliderComponent.swift @@ -15,7 +15,7 @@ class SliderComponent: GKComponent { init(width: CGFloat, position: CGPoint) { sliderNode = SliderNode(width: width, position: position) - sliderNode.zPosition = 4 + sliderNode.zPosition = 5 super.init() } diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index b739eca..69cda81 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -39,6 +39,7 @@ class EntityManager { scene.addChild(modalEntitiy.header) scene.addChild(modalEntitiy.body) scene.addChild(modalEntitiy.footer) + scene.addChild(modalEntitiy.overlay) isModal = true } @@ -279,6 +280,7 @@ class EntityManager { modal.header.removeFromParent() modal.body.removeFromParent() modal.footer.removeFromParent() + modal.overlay.removeFromParent() if let slider = modal.component(ofType: SliderComponent.self) { slider.sliderNode.removeFromParent() diff --git a/GoldWars/GoldWars/Entities/HUD.swift b/GoldWars/GoldWars/Entities/HUD.swift index 6ff9a2d..24f92a0 100644 --- a/GoldWars/GoldWars/Entities/HUD.swift +++ b/GoldWars/GoldWars/Entities/HUD.swift @@ -77,7 +77,7 @@ class HUD: GKEntity { onButtonPress: { } ) finishButton.size = CGSize(width: 80, height: 40) - finishButton.zPosition = 4 + finishButton.zPosition = 2 super.init() finishButton.onButtonPress = { [unowned self] in diff --git a/GoldWars/GoldWars/Entities/Modal.swift b/GoldWars/GoldWars/Entities/Modal.swift index 50747af..9e9a0d4 100644 --- a/GoldWars/GoldWars/Entities/Modal.swift +++ b/GoldWars/GoldWars/Entities/Modal.swift @@ -23,6 +23,7 @@ class Modal: GKEntity{ var header: SKLabelNode var body: SKLabelNode var footer: SKLabelNode + var overlay: SKSpriteNode init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, gameScene: GameScene, currentDraggedBase: Base?, touchLocation: CGPoint, collisionBase: Base?) { unitCount = base.unitCount @@ -31,14 +32,17 @@ class Modal: GKEntity{ background = SKSpriteNode(texture: texture, size: texture.size()) background.setScale(2.4) background.position = anchorPoint - background.zPosition = 3 + background.zPosition = 4 closeButton = ButtonNode(textureName: "red_cross", text: "", isEnabled: true, position: CGPoint(x: anchorPoint.x + 195, y: anchorPoint.y + 178), onButtonPress: { EntityManager.gameEMInstance.removeModal() }) closeButton.size = CGSize(width: 26, height: 26) - closeButton.zPosition = 4 + closeButton.zPosition = 5 + overlay = SKSpriteNode(color: UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.7), size: gameScene.size) + overlay.anchorPoint = gameScene.anchorPoint + overlay.zPosition = 3 switch modaltype { case .BaseDetails: @@ -58,7 +62,7 @@ class Modal: GKEntity{ self.header.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y + 90) self.header.fontName = "HelveticaNeue-Bold" self.header.fontSize = 40 - self.header.zPosition = 4 + self.header.zPosition = 5 self.body.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 20) self.body.numberOfLines = 2 @@ -66,12 +70,12 @@ class Modal: GKEntity{ self.body.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.center self.body.fontName = "HelveticaNeue-Bold" self.body.fontSize = 40 - self.body.zPosition = 4 + self.body.zPosition = 5 self.footer.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 40) self.footer.fontName = "HelveticaNeue-Bold" self.footer.fontSize = 40 - self.footer.zPosition = 4 + self.footer.zPosition = 5 super.init() @@ -99,11 +103,6 @@ class Modal: GKEntity{ if entityManager.isModal && entity.isMember(of: Modal.self) { entityManager.remove(entity) } - for child in gameScene.children { - if(child.name != "fire"){ - child.alpha = 1 - } - } } } diff --git a/GoldWars/GoldWars/Scenes/GameScene.swift b/GoldWars/GoldWars/Scenes/GameScene.swift index 892f2e3..d8ad5bb 100644 --- a/GoldWars/GoldWars/Scenes/GameScene.swift +++ b/GoldWars/GoldWars/Scenes/GameScene.swift @@ -80,11 +80,6 @@ class GameScene: SKScene{ spriteNode?.touchesBegan(touches, with: event) if let baseEntity = entity as? Base { if baseEntity.ownershipPlayer == GKLocalPlayer.local { - for child in self.children { - if(child.name != "fire"){ - child.alpha = 0.3 - } - } entityManager.add(Modal(modaltype: .BaseDetails, base: entity as! Base, anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),