Merge branch '103-info-modal-entfernen' into 'development'
Resolve "Info-Modal entfernen" Closes #103 See merge request marcel.schwarz/software-projekt-2!125
This commit is contained in:
commit
c46849e95d
@ -8,8 +8,7 @@
|
||||
|
||||
import GameplayKit
|
||||
|
||||
enum ModalType: String{
|
||||
case BaseDetails
|
||||
enum ModalType: String {
|
||||
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,6 +50,7 @@ class RoundTimer: Timer {
|
||||
EntityManager.gameEMInstance.updateTime(time: (timeLeft > 0 ? String(timeLeft) : roundEnded))
|
||||
|
||||
if timeLeft == 0 {
|
||||
EntityManager.gameEMInstance.removeModal()
|
||||
RoundCalculatorService.sharedInstance.resetNumberOfAttacksAndFormats()
|
||||
if !MultiplayerNetwork.sharedInstance.isSending {
|
||||
MultiplayerNetwork.sharedInstance.sendPlayerMoves(localRoundData: DataService.sharedInstance.localRoundData)
|
||||
|
@ -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