Solve Mergeconflicts

This commit is contained in:
Aldin Duraki 2020-05-17 21:48:17 +02:00
parent 69e41a9cd3
commit 1dc97c3bab
3 changed files with 15 additions and 16 deletions

View File

@ -12,7 +12,7 @@ class Modal: GKEntity{
var unitCount:Int var unitCount:Int
init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, entityManager: EntityManager, gameScene: SKScene) { init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, gameScene: SKScene) {
unitCount = base.unitCount unitCount = base.unitCount
super.init() super.init()
switch modaltype{ switch modaltype{
@ -20,7 +20,7 @@ class Modal: GKEntity{
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint)) addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
addComponent(ModalContentComponent(header: "Basis Information", body: "Diese Basis enthält \(base.unitCount) Einheiten", footer: "", anchorPoint: anchorPoint)) addComponent(ModalContentComponent(header: "Basis Information", body: "Diese Basis enthält \(base.unitCount) Einheiten", footer: "", anchorPoint: anchorPoint))
addComponent(ButtonComponent(iconName: "", text: "Zurück", position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 120), isEnabled: true, onButtonPress: { addComponent(ButtonComponent(iconName: "", text: "Zurück", position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 120), isEnabled: true, onButtonPress: {
self.removeModalEntities(entityManager: entityManager, gameScene: gameScene) self.removeModalEntities(gameScene: gameScene)
})) }))
case .BaseAttack: case .BaseAttack:
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint)) addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
@ -28,7 +28,7 @@ class Modal: GKEntity{
addComponent(ModalContentComponent(header: "Angriff", body: "Schicke \(unitCount / 2) Einheiten", addComponent(ModalContentComponent(header: "Angriff", body: "Schicke \(unitCount / 2) Einheiten",
footer: "", anchorPoint: anchorPoint)) footer: "", anchorPoint: anchorPoint))
addComponent(ButtonComponent(iconName: "", text: "Senden", position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 120), isEnabled: true, onButtonPress: { addComponent(ButtonComponent(iconName: "", text: "Senden", position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 120), isEnabled: true, onButtonPress: {
self.removeModalEntities(entityManager: entityManager, gameScene: gameScene) self.removeModalEntities(gameScene: gameScene)
})) }))
} }
} }
@ -37,10 +37,10 @@ class Modal: GKEntity{
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func removeModalEntities(entityManager: EntityManager, gameScene: SKScene){ func removeModalEntities(gameScene: SKScene){
for entity in entityManager.entities { for entity in EntityManager.sharedInstance.entities {
if entityManager.isModal && entity.isMember(of: Modal.self) { if EntityManager.sharedInstance.isModal && entity.isMember(of: Modal.self) {
entityManager.remove(entity) EntityManager.sharedInstance.remove(entity)
} }
for child in gameScene.children { for child in gameScene.children {
if(child.name != "fire"){ if(child.name != "fire"){

View File

@ -56,7 +56,7 @@ class RoundCalculatorServie {
playerMovesByBase.removeValue(forKey: playerName) playerMovesByBase.removeValue(forKey: playerName)
} }
for (playerName, playerMove) in playerMovesByBase { for (_, playerMove) in playerMovesByBase {
for var base in currentSnapshotModel! { for var base in currentSnapshotModel! {
if base.baseId == playerMove.fromBase { if base.baseId == playerMove.fromBase {
base.unitCount -= playerMove.unitCount base.unitCount -= playerMove.unitCount

View File

@ -24,8 +24,8 @@ class GameScene: SKScene{
} }
func initMap() { func initMap() {
MapFactory(scene: self, entityManager: self.entityManager).loadMap(playerCount: 2) MapFactory(scene: self, entityManager: EntityManager.sharedInstance).loadMap(playerCount: 2)
DataService.sharedInstance.safeSnapshot(snapshotModel: entityManager.getSnapshotModel()) DataService.sharedInstance.safeSnapshot(snapshotModel: EntityManager.sharedInstance.getSnapshotModel())
} }
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
@ -48,14 +48,13 @@ class GameScene: SKScene{
EntityManager.sharedInstance.add(Modal(modaltype: .BaseAttack, EntityManager.sharedInstance.add(Modal(modaltype: .BaseAttack,
base: currentDraggedBase!, base: currentDraggedBase!,
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
entityManager: EntityManager.sharedInstance, gameScene: self)) gameScene: self))
EntityManager.sharedInstance.update((currentDraggedBase?.attackBase(base: base, units: 100))!) EntityManager.sharedInstance.update((currentDraggedBase?.doPlayerMoveTypeToBase(base: base, playerMoveType: PlayerMoveType.AtkMove, units: 100))!)
}else { }else {
EntityManager.sharedInstance.add(Modal(modaltype: .BaseAttack, EntityManager.sharedInstance.add(Modal(modaltype: .BaseAttack,
base: currentDraggedBase!, base: currentDraggedBase!,
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), gameScene: self))
entityManager: entityManager, gameScene: self)) EntityManager.sharedInstance.update((currentDraggedBase?.doPlayerMoveTypeToBase(base: base,playerMoveType: PlayerMoveType.TxnMove, units: -100))!)
entityManager.update((currentDraggedBase?.doPlayerMoveTypeToBase(base: base,playerMoveType: PlayerMoveType.TxnMove, units: -100))!)
} }
} }
@ -76,7 +75,7 @@ class GameScene: SKScene{
EntityManager.sharedInstance.add(Modal(modaltype: .BaseDetails, EntityManager.sharedInstance.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),
entityManager: EntityManager.sharedInstance, gameScene: self)) gameScene: self))
} }
} }
} }