Ignore the last two Commits -> stupidy impact

* Access to ButtonNode via Component
* revert work and implement everything needed
This commit is contained in:
127-Z3R0 2020-06-25 14:39:31 +02:00
parent 6970f27a61
commit bf50703b1c
2 changed files with 28 additions and 30 deletions

View File

@ -66,10 +66,6 @@ class EntityManager {
scene.addChild(spinningLogoEntity.warsLetteringNode)
}
if let settingsButtonEntity = entity as? SettingsButton {
scene.addChild(settingsButtonEntity.settingsButton)
}
if let wayEntity = entity as? Way {
scene.addChild(wayEntity.localWayComponent)
}
@ -298,8 +294,8 @@ class EntityManager {
}
func changeSettingsButtonText(buttonName: String, text: String) {
let button = entities.filter{$0 is SettingsButton && ($0 as! SettingsButton).name == buttonName }[0] as! SettingsButton
button.settingsButton.label.text = text
let button = entities.filter{$0 is Button && ($0 as! Button).name == buttonName }[0] as! Button
button.component(ofType: ButtonComponent.self)?.buttonNode.label.text = text
}
func getHUD() -> HUD? {

View File

@ -27,7 +27,8 @@ class SettingsScene: SKScene {
let scene = MenuScene(size: self.size)
self.loadScene(scene: scene)
}))
entityManager.add(SettingsButton(name: "StopMenuMusic",
entityManager.add(Button(name: "StopMenuMusic",
textureName: "yellow_button04",
text: musicButtonText,
position: CGPoint(x: self.size.width * 0.6, y: self.size.height / 2),
onButtonPress: {
@ -41,7 +42,8 @@ class SettingsScene: SKScene {
self.entityManager.changeSettingsButtonText(buttonName: "StopMenuMusic", text: "ON")
}
}))
entityManager.add(SettingsButton(name: "StopMovingBackground",
entityManager.add(Button(name: "StopMovingBackground",
textureName: "yellow_button04",
text: "MOVE",
position: CGPoint(x: self.size.width * 0.6, y: self.size.height / 2 - 100),
onButtonPress: {