add Label to EntityManager and implement Labels to SettingsScene

This commit is contained in:
127-Z3R0 2020-05-13 15:00:29 +02:00
parent 1ca5399a2e
commit ec2510fd53
2 changed files with 37 additions and 2 deletions

View File

@ -64,6 +64,9 @@ class EntityManager {
scene.addChild(sliderNode.sliderKnob)
scene.addChild(sliderNode.sliderLine)
}
if let labelNode = entity.component(ofType: LabelComponent.self)?.labelNode {
scene.addChild(labelNode)
}
}
func remove(_ entity: GKEntity) {

View File

@ -26,7 +26,7 @@ class SettingsScene: SKScene {
entityManager.add(Button(name: "StopMenuMusic",
iconName: "",
text: "ON/OFF",
position: CGPoint(x: self.size.width / 2, y: self.size.height / 2),
position: CGPoint(x: self.size.width * 0.6, y: self.size.height / 2),
onButtonPress: {
if SoundManager.sharedInstance.isMusicPlaying {
SoundManager.sharedInstance.stopMenuMusic()
@ -39,7 +39,7 @@ class SettingsScene: SKScene {
entityManager.add(Button(name: "StopMovingBackground",
iconName: "",
text: "MOVE/STOP",
position: CGPoint(x: self.size.width / 2, y: self.size.height / 2 - 100),
position: CGPoint(x: self.size.width * 0.6, y: self.size.height / 2 - 100),
onButtonPress: {
if BackgroundComponent.isMovingBackgroundEnabled {
BackgroundComponent.isMovingBackgroundEnabled = false
@ -47,6 +47,38 @@ class SettingsScene: SKScene {
BackgroundComponent.isMovingBackgroundEnabled = true
}
}))
entityManager.add(Label(fontnamed: "Courier-Bold",
name: "SettingsLabel",
text: "Settings",
fontSize: 200.0,
fontColor: .black,
position: CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.7),
horizontalAlignmentMode: .center,
vertikalAligmentMode: .baseline,
isAnimationEnabled: true,
isAnimationInfinite: true)
)
entityManager.add(Label(fontnamed: "Courier-Bold",
name: "LabelMusic",
text: "Music", fontSize: 50.0,
fontColor: .black,
position: CGPoint(x: self.size.width * 0.5, y: self.size.height / 2 - 15),
horizontalAlignmentMode: .right,
vertikalAligmentMode: .baseline,
isAnimationEnabled: true,
isAnimationInfinite: false)
)
entityManager.add(Label(fontnamed: "Courier-Bold",
name: "LabelBackground",
text: "Background",
fontSize: 50.0,
fontColor: .black,
position: CGPoint(x: self.size.width * 0.5, y: self.size.height / 2 - 115),
horizontalAlignmentMode: .right,
vertikalAligmentMode: .baseline,
isAnimationEnabled: true,
isAnimationInfinite: false)
)
entityManager.add(Background(size: self.size))
}