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
init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, entityManager: EntityManager, gameScene: SKScene) {
init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, gameScene: SKScene) {
unitCount = base.unitCount
super.init()
switch modaltype{
@ -20,7 +20,7 @@ class Modal: GKEntity{
addComponent(ModalBackgroundComponent(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: {
self.removeModalEntities(entityManager: entityManager, gameScene: gameScene)
self.removeModalEntities(gameScene: gameScene)
}))
case .BaseAttack:
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
@ -28,7 +28,7 @@ class Modal: GKEntity{
addComponent(ModalContentComponent(header: "Angriff", body: "Schicke \(unitCount / 2) Einheiten",
footer: "", anchorPoint: anchorPoint))
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")
}
func removeModalEntities(entityManager: EntityManager, gameScene: SKScene){
for entity in entityManager.entities {
if entityManager.isModal && entity.isMember(of: Modal.self) {
entityManager.remove(entity)
func removeModalEntities(gameScene: SKScene){
for entity in EntityManager.sharedInstance.entities {
if EntityManager.sharedInstance.isModal && entity.isMember(of: Modal.self) {
EntityManager.sharedInstance.remove(entity)
}
for child in gameScene.children {
if(child.name != "fire"){

View File

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

View File

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