review changes

This commit is contained in:
Niko Jochim 2020-06-18 22:53:41 +02:00
parent adf01db4bf
commit bddad86674
3 changed files with 15 additions and 20 deletions

View File

@ -30,8 +30,7 @@ class SliderNode :SKNode {
sliderLine.fillColor = SKColor.white
sliderLine.zPosition = 4
hiddenKnob = SliderKnob(circleOfRadius: 60)
hiddenKnob = SliderKnob(circleOfRadius: 58 )
hiddenKnob.min = position.x - width / 2
hiddenKnob.max = position.x + width / 2
hiddenKnob.fillColor = SKColor.red
@ -52,7 +51,6 @@ class SliderNode :SKNode {
fatalError("init(coder:) has not been implemented")
}
}
class SliderKnob: SKShapeNode {

View File

@ -53,11 +53,11 @@ class Modal: GKEntity{
switch modaltype {
case .BaseAttack:
header = SKLabelNode(text: "Angriff")
body = SKLabelNode(text: "Schicke \(unitCount / 2)\nEinheiten")
body = SKLabelNode(text: "\(unitCount / 2) Einheiten")
footer = SKLabelNode()
case .BaseMoveOwnUnits:
header = SKLabelNode(text: "Formation")
body = SKLabelNode(text: "Sende \(unitCount / 2)\nEinheiten")
body = SKLabelNode(text: "\(unitCount / 2) Einheiten")
footer = SKLabelNode()
case .PauseGame:
header = SKLabelNode(text: "Pause")
@ -71,7 +71,7 @@ class Modal: GKEntity{
self.header.fontSize = 40
self.header.zPosition = 5
self.body.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 20)
self.body.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y + 15)
self.body.numberOfLines = 2
self.body.preferredMaxLayoutWidth = 390
self.body.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.center
@ -86,17 +86,14 @@ class Modal: GKEntity{
super.init()
switch modaltype{
case .BaseAttack, .BaseMoveOwnUnits:
let text = (modaltype == .BaseAttack) ? "Angriff" : "Senden"
addComponent(SliderComponent(width: 300, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 50)))
addComponent(ButtonComponent(textureName: "yellow_button04", text: text, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 105), isEnabled: true, onButtonPress: {
addComponent(SliderComponent(width: 300, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 15)))
addComponent(ButtonComponent(textureName: "yellow_button04", text: text, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 95), isEnabled: true, onButtonPress: {
self.sendUnits(currentDraggedBase: currentDraggedBase, touchLocation: touchLocation!, gameScene: gameScene, collisionBase: collisionBase)
EntityManager.gameEMInstance.removeModal()
}))
default:
break
}
}
required init?(coder: NSCoder) {

View File

@ -120,7 +120,7 @@ class GameScene: SKScene{
} else if Int(GameScene.sendUnits) == currentDraggedBase?.unitCount {
GameScene.sendUnits -= 1
}
modal.body.text = "Schicke \(GameScene.sendUnits) Einheiten "
modal.body.text = "\(GameScene.sendUnits) Einheiten "
}
}
}