Remove base details modal
This commit is contained in:
parent
0d8a134445
commit
afad3e808e
@ -9,7 +9,6 @@
|
||||
import GameplayKit
|
||||
|
||||
enum ModalType: String {
|
||||
case BaseDetails
|
||||
case BaseAttack
|
||||
case BaseMoveOwnUnits
|
||||
case PauseGame
|
||||
@ -52,10 +51,6 @@ class Modal: GKEntity{
|
||||
overlay.zPosition = 3
|
||||
|
||||
switch modaltype {
|
||||
case .BaseDetails:
|
||||
header = SKLabelNode(text: "Information")
|
||||
body = SKLabelNode(text: "Diese Basis enthält \(base!.unitCount) Einheiten")
|
||||
footer = SKLabelNode()
|
||||
case .BaseAttack:
|
||||
header = SKLabelNode(text: "Angriff")
|
||||
body = SKLabelNode(text: "Schicke \(unitCount / 2)\nEinheiten")
|
||||
@ -92,10 +87,6 @@ class Modal: GKEntity{
|
||||
super.init()
|
||||
|
||||
switch modaltype{
|
||||
case .BaseDetails:
|
||||
addComponent(ButtonComponent(textureName: "yellow_button04", text: "Zurück", position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 105), isEnabled: true, onButtonPress: {
|
||||
EntityManager.gameEMInstance.removeModal()
|
||||
}))
|
||||
case .BaseAttack, .BaseMoveOwnUnits:
|
||||
let text = (modaltype == .BaseAttack) ? "Angriff" : "Senden"
|
||||
addComponent(SliderComponent(width: 300, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 50)))
|
||||
|
@ -50,12 +50,11 @@ class GameScene: SKScene{
|
||||
entityManager.getBasesByPlayer(for: GKLocalPlayer.local).forEach({base in
|
||||
moveFireAndBase(base: base, touchLocation: base.position)
|
||||
})
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for entity in entityManager.entities {
|
||||
let spriteNode = entity.component(ofType: DefaultBaseComponent.self)?.spriteNode
|
||||
//FIXME: this is confusing
|
||||
addBaseDetails(touchLocation: touchLocation, spriteNode: spriteNode, touches: touches, event: event, entity: entity)
|
||||
if atPoint(touchLocation) == entity.component(ofType: DefaultBaseComponent.self)?.spriteNode {
|
||||
entity.component(ofType: DefaultBaseComponent.self)?.spriteNode.touchesBegan(touches, with: event)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,21 +79,6 @@ class GameScene: SKScene{
|
||||
entityManager.getBackground()?.update(deltaTime: currentTime)
|
||||
}
|
||||
|
||||
func addBaseDetails(touchLocation: CGPoint, spriteNode: SKNode?, touches: Set<UITouch>, event: UIEvent?, entity: GKEntity){
|
||||
if atPoint(touchLocation) == spriteNode && !entityManager.isModal {
|
||||
spriteNode?.touchesBegan(touches, with: event)
|
||||
if let baseEntity = entity as? Base {
|
||||
if baseEntity.ownershipPlayer == GKLocalPlayer.local {
|
||||
entityManager.add(Modal(modaltype: .BaseDetails,
|
||||
base: entity as? Base,
|
||||
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
|
||||
gameScene: self,
|
||||
currentDraggedBase: currentDraggedBase, touchLocation: touchLocation, collisionBase: collisionBase))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addAttackDetails(touchLocation: CGPoint){
|
||||
for base in currentDraggedBase!.adjacencyList {
|
||||
if atPoint(touchLocation) == base.component(ofType: DefaultBaseComponent.self)?.spriteNode {
|
||||
|
Loading…
Reference in New Issue
Block a user