From a78b9269c0dd603dbe29247f5600cddfa8a6d0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chauntalle=20Schu=CC=88le?= Date: Thu, 14 May 2020 14:04:25 +0200 Subject: [PATCH] Adding modalButton to Entity Manager --- GoldWars/GoldWars/Entities/EntityManager.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 0f7166c..6c92437 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -30,7 +30,7 @@ class EntityManager { } if let spriteNode = entity.component(ofType: ModalBackgroundComponent.self)?.spriteNode { scene.addChild(spriteNode) - isModal = true + //isModal = true } if let modal = entity.component(ofType: ModalContentComponent.self) { scene.addChild(modal.header) @@ -54,6 +54,7 @@ class EntityManager { } if let buttonNode = entity.component(ofType: ButtonComponent.self)?.buttonNode { scene.addChild(buttonNode) + isModal = true } if let nodes = entity.component(ofType: BackgroundComponent.self)?.nodes { for node in nodes { @@ -72,7 +73,7 @@ class EntityManager { } if let spriteNode = entity.component(ofType: ModalBackgroundComponent.self)?.spriteNode { spriteNode.removeFromParent() - isModal = false + //isModal = false } if let modal = entity.component(ofType: ModalContentComponent.self) { modal.header.removeFromParent() @@ -83,6 +84,10 @@ class EntityManager { sliderNode.sliderKnob.removeFromParent() sliderNode.sliderLine.removeFromParent() } + if let modalButton = entity.component(ofType: ButtonComponent.self) { + modalButton.buttonNode.removeFromParent() + isModal = false + } entities.remove(entity) }