Merge branch '74-gray-overlay-auf-nodes' into 'development'
Resolve "Gray Overlay auf Nodes" Closes #74 See merge request marcel.schwarz/software-projekt-2!103
This commit is contained in:
commit
5bb1b6764a
@ -15,7 +15,7 @@ class SliderComponent: GKComponent {
|
|||||||
|
|
||||||
init(width: CGFloat, position: CGPoint) {
|
init(width: CGFloat, position: CGPoint) {
|
||||||
sliderNode = SliderNode(width: width, position: position)
|
sliderNode = SliderNode(width: width, position: position)
|
||||||
sliderNode.zPosition = 4
|
sliderNode.zPosition = 5
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ class EntityManager {
|
|||||||
scene.addChild(modalEntitiy.header)
|
scene.addChild(modalEntitiy.header)
|
||||||
scene.addChild(modalEntitiy.body)
|
scene.addChild(modalEntitiy.body)
|
||||||
scene.addChild(modalEntitiy.footer)
|
scene.addChild(modalEntitiy.footer)
|
||||||
|
scene.addChild(modalEntitiy.overlay)
|
||||||
isModal = true
|
isModal = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,6 +280,7 @@ class EntityManager {
|
|||||||
modal.header.removeFromParent()
|
modal.header.removeFromParent()
|
||||||
modal.body.removeFromParent()
|
modal.body.removeFromParent()
|
||||||
modal.footer.removeFromParent()
|
modal.footer.removeFromParent()
|
||||||
|
modal.overlay.removeFromParent()
|
||||||
|
|
||||||
if let slider = modal.component(ofType: SliderComponent.self) {
|
if let slider = modal.component(ofType: SliderComponent.self) {
|
||||||
slider.sliderNode.removeFromParent()
|
slider.sliderNode.removeFromParent()
|
||||||
|
@ -77,7 +77,7 @@ class HUD: GKEntity {
|
|||||||
onButtonPress: { }
|
onButtonPress: { }
|
||||||
)
|
)
|
||||||
finishButton.size = CGSize(width: 80, height: 40)
|
finishButton.size = CGSize(width: 80, height: 40)
|
||||||
finishButton.zPosition = 4
|
finishButton.zPosition = 2
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
finishButton.onButtonPress = { [unowned self] in
|
finishButton.onButtonPress = { [unowned self] in
|
||||||
|
@ -23,6 +23,7 @@ class Modal: GKEntity{
|
|||||||
var header: SKLabelNode
|
var header: SKLabelNode
|
||||||
var body: SKLabelNode
|
var body: SKLabelNode
|
||||||
var footer: SKLabelNode
|
var footer: SKLabelNode
|
||||||
|
var overlay: SKSpriteNode
|
||||||
|
|
||||||
init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, gameScene: GameScene, currentDraggedBase: Base?, touchLocation: CGPoint, collisionBase: Base?) {
|
init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, gameScene: GameScene, currentDraggedBase: Base?, touchLocation: CGPoint, collisionBase: Base?) {
|
||||||
unitCount = base.unitCount
|
unitCount = base.unitCount
|
||||||
@ -31,14 +32,17 @@ class Modal: GKEntity{
|
|||||||
background = SKSpriteNode(texture: texture, size: texture.size())
|
background = SKSpriteNode(texture: texture, size: texture.size())
|
||||||
background.setScale(2.4)
|
background.setScale(2.4)
|
||||||
background.position = anchorPoint
|
background.position = anchorPoint
|
||||||
background.zPosition = 3
|
background.zPosition = 4
|
||||||
|
|
||||||
closeButton = ButtonNode(textureName: "red_cross", text: "", isEnabled: true, position: CGPoint(x: anchorPoint.x + 195, y: anchorPoint.y + 178), onButtonPress: {
|
closeButton = ButtonNode(textureName: "red_cross", text: "", isEnabled: true, position: CGPoint(x: anchorPoint.x + 195, y: anchorPoint.y + 178), onButtonPress: {
|
||||||
EntityManager.gameEMInstance.removeModal()
|
EntityManager.gameEMInstance.removeModal()
|
||||||
})
|
})
|
||||||
closeButton.size = CGSize(width: 26, height: 26)
|
closeButton.size = CGSize(width: 26, height: 26)
|
||||||
closeButton.zPosition = 4
|
closeButton.zPosition = 5
|
||||||
|
|
||||||
|
overlay = SKSpriteNode(color: UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.7), size: gameScene.size)
|
||||||
|
overlay.anchorPoint = gameScene.anchorPoint
|
||||||
|
overlay.zPosition = 3
|
||||||
|
|
||||||
switch modaltype {
|
switch modaltype {
|
||||||
case .BaseDetails:
|
case .BaseDetails:
|
||||||
@ -58,7 +62,7 @@ class Modal: GKEntity{
|
|||||||
self.header.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y + 90)
|
self.header.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y + 90)
|
||||||
self.header.fontName = "HelveticaNeue-Bold"
|
self.header.fontName = "HelveticaNeue-Bold"
|
||||||
self.header.fontSize = 40
|
self.header.fontSize = 40
|
||||||
self.header.zPosition = 4
|
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 - 20)
|
||||||
self.body.numberOfLines = 2
|
self.body.numberOfLines = 2
|
||||||
@ -66,12 +70,12 @@ class Modal: GKEntity{
|
|||||||
self.body.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.center
|
self.body.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.center
|
||||||
self.body.fontName = "HelveticaNeue-Bold"
|
self.body.fontName = "HelveticaNeue-Bold"
|
||||||
self.body.fontSize = 40
|
self.body.fontSize = 40
|
||||||
self.body.zPosition = 4
|
self.body.zPosition = 5
|
||||||
|
|
||||||
self.footer.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 40)
|
self.footer.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 40)
|
||||||
self.footer.fontName = "HelveticaNeue-Bold"
|
self.footer.fontName = "HelveticaNeue-Bold"
|
||||||
self.footer.fontSize = 40
|
self.footer.fontSize = 40
|
||||||
self.footer.zPosition = 4
|
self.footer.zPosition = 5
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
@ -99,11 +103,6 @@ class Modal: GKEntity{
|
|||||||
if entityManager.isModal && entity.isMember(of: Modal.self) {
|
if entityManager.isModal && entity.isMember(of: Modal.self) {
|
||||||
entityManager.remove(entity)
|
entityManager.remove(entity)
|
||||||
}
|
}
|
||||||
for child in gameScene.children {
|
|
||||||
if(child.name != "fire"){
|
|
||||||
child.alpha = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +80,6 @@ class GameScene: SKScene{
|
|||||||
spriteNode?.touchesBegan(touches, with: event)
|
spriteNode?.touchesBegan(touches, with: event)
|
||||||
if let baseEntity = entity as? Base {
|
if let baseEntity = entity as? Base {
|
||||||
if baseEntity.ownershipPlayer == GKLocalPlayer.local {
|
if baseEntity.ownershipPlayer == GKLocalPlayer.local {
|
||||||
for child in self.children {
|
|
||||||
if(child.name != "fire"){
|
|
||||||
child.alpha = 0.3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
entityManager.add(Modal(modaltype: .BaseDetails,
|
entityManager.add(Modal(modaltype: .BaseDetails,
|
||||||
base: entity as! Base,
|
base: entity as! Base,
|
||||||
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
|
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
|
||||||
|
Loading…
Reference in New Issue
Block a user