Adding Abbrechen Button to ModalAttack
This commit is contained in:
parent
5d98027d8a
commit
8b840b5089
@ -68,6 +68,10 @@ class EntityManager {
|
|||||||
if let labelNode = entity.component(ofType: LabelComponent.self)?.labelNode {
|
if let labelNode = entity.component(ofType: LabelComponent.self)?.labelNode {
|
||||||
scene.addChild(labelNode)
|
scene.addChild(labelNode)
|
||||||
}
|
}
|
||||||
|
if let cancelBtnNode = entity.component(ofType: CancelBtnComponent.self)?.cancelBtnNode {
|
||||||
|
scene.addChild(cancelBtnNode)
|
||||||
|
isModal = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func remove(_ entity: GKEntity) {
|
func remove(_ entity: GKEntity) {
|
||||||
@ -90,6 +94,10 @@ class EntityManager {
|
|||||||
modalButton.buttonNode.removeFromParent()
|
modalButton.buttonNode.removeFromParent()
|
||||||
isModal = false
|
isModal = false
|
||||||
}
|
}
|
||||||
|
if let cancelBtnNode = entity.component(ofType: CancelBtnComponent.self)?.cancelBtnNode {
|
||||||
|
cancelBtnNode.removeFromParent()
|
||||||
|
isModal = false
|
||||||
|
}
|
||||||
entities.remove(entity)
|
entities.remove(entity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,9 @@ class Modal: GKEntity{
|
|||||||
addComponent(ButtonComponent(iconName: "", text: "Senden", position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 120), isEnabled: true, onButtonPress: {
|
addComponent(ButtonComponent(iconName: "", text: "Senden", position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 120), isEnabled: true, onButtonPress: {
|
||||||
self.removeModalEntities(entityManager: entityManager, gameScene: gameScene)
|
self.removeModalEntities(entityManager: entityManager, gameScene: gameScene)
|
||||||
}))
|
}))
|
||||||
|
addComponent(CancelBtnComponent(iconName: "", text: "", position: CGPoint(x: anchorPoint.x + 160, y: anchorPoint.y + 140), isEnabled: true, onButtonPress: {
|
||||||
|
self.removeModalEntities(entityManager: entityManager, gameScene: gameScene)
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user