diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesBasen.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/RulesBasen.imageset/Contents.json new file mode 100644 index 0000000..afaa7cd --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/RulesBasen.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "RulesBasen.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesBasen.imageset/RulesBasen.png b/GoldWars/GoldWars/Assets.xcassets/RulesBasen.imageset/RulesBasen.png new file mode 100644 index 0000000..ddce7ca Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/RulesBasen.imageset/RulesBasen.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesBoost.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/RulesBoost.imageset/Contents.json new file mode 100644 index 0000000..0f25890 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/RulesBoost.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "RulesBoost.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesBoost.imageset/RulesBoost.png b/GoldWars/GoldWars/Assets.xcassets/RulesBoost.imageset/RulesBoost.png new file mode 100644 index 0000000..a226098 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/RulesBoost.imageset/RulesBoost.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesEinheiten.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/RulesEinheiten.imageset/Contents.json new file mode 100644 index 0000000..6043187 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/RulesEinheiten.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "RulesEinheiten.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesEinheiten.imageset/RulesEinheiten.png b/GoldWars/GoldWars/Assets.xcassets/RulesEinheiten.imageset/RulesEinheiten.png new file mode 100644 index 0000000..786d326 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/RulesEinheiten.imageset/RulesEinheiten.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesErfolge.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/RulesErfolge.imageset/Contents.json new file mode 100644 index 0000000..1c8c4fb --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/RulesErfolge.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "RulesErfolge.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesErfolge.imageset/RulesErfolge.png b/GoldWars/GoldWars/Assets.xcassets/RulesErfolge.imageset/RulesErfolge.png new file mode 100644 index 0000000..732b323 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/RulesErfolge.imageset/RulesErfolge.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesSpiel.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/RulesSpiel.imageset/Contents.json new file mode 100644 index 0000000..e280c74 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/RulesSpiel.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "RulesSpiel.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesSpiel.imageset/RulesSpiel.png b/GoldWars/GoldWars/Assets.xcassets/RulesSpiel.imageset/RulesSpiel.png new file mode 100644 index 0000000..2ca621c Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/RulesSpiel.imageset/RulesSpiel.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesSpielende.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/RulesSpielende.imageset/Contents.json new file mode 100644 index 0000000..9b2c235 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/RulesSpielende.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "RulesSpielende.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/RulesSpielende.imageset/RulesSpielende.png b/GoldWars/GoldWars/Assets.xcassets/RulesSpielende.imageset/RulesSpielende.png new file mode 100644 index 0000000..7775b92 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/RulesSpielende.imageset/RulesSpielende.png differ diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 14c0627..28e82d3 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -20,11 +20,9 @@ class EntityManager { var entities = Set() var scene: SKScene var isModal: Bool - var isRules: Bool private init() { isModal = false - isRules = false scene = SKScene.init() } @@ -70,16 +68,7 @@ class EntityManager { } if let rulesEntity = entity as? Rules { - scene.addChild(rulesEntity.header) - scene.addChild(rulesEntity.text1) - scene.addChild(rulesEntity.text2) - scene.addChild(rulesEntity.text3) - scene.addChild(rulesEntity.text4) scene.addChild(rulesEntity.node1) - scene.addChild(rulesEntity.node2) - scene.addChild(rulesEntity.node3) - // scene.addChild(rulesEntity.overlay) - isRules = true } if let wayEntity = entity as? Way { @@ -385,21 +374,12 @@ class EntityManager { func removeRules(){ entities.forEach({entity in if let rules = entity as? Rules { - rules.header.removeFromParent() - rules.text1.removeFromParent() - rules.text2.removeFromParent() - rules.text3.removeFromParent() - rules.text4.removeFromParent() rules.node1.removeFromParent() - rules.node2.removeFromParent() - rules.node3.removeFromParent() if let button = rules.component(ofType: ButtonComponent.self) { button.buttonNode.removeFromParent() } self.remove(rules) - - isRules = false } }) } diff --git a/GoldWars/GoldWars/RulesScene.swift b/GoldWars/GoldWars/RulesScene.swift index e23c7f2..c79bbf4 100644 --- a/GoldWars/GoldWars/RulesScene.swift +++ b/GoldWars/GoldWars/RulesScene.swift @@ -118,233 +118,28 @@ enum RulesCategory: String{ class Rules: GKEntity { var entityManager = EntityManager.menuEMInstance - //var rulesCategory: RulesCategory - - var header: SKLabelNode - var text1: SKLabelNode - var text2: SKLabelNode - var text3: SKLabelNode - var text4: SKLabelNode var node1: SKSpriteNode - var node2: SKSpriteNode - var node3: SKSpriteNode init(rulesScene: RulesScene, rulesCategory: RulesCategory) { - + let texture: SKTexture switch rulesCategory { case .Spielbeschreibung: - header = SKLabelNode(text: "Kurze Spielbeschreibung:") - - text1 = SKLabelNode(text: "GoldWars ist ein strategisches, rundenbasiertes Kampfspiel.\nZwei Spieler treten gegeneinander an und versuchen ihre Basen zu erweitern. Dazu schickst du Einheiten auf eine neue Basis.") - text1.position = CGPoint(x: rulesScene.size.width * 0.5 + 50, y: rulesScene.size.height * 0.6 - 20) - text1.numberOfLines = 4 - text1.preferredMaxLayoutWidth = 750 - - let texture = SKTexture(imageNamed:"yellow_boxTick") - node1 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node1.zPosition = 4 - - text2 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") - text2.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) - - node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) - node2.zPosition = 4 - - text3 = SKLabelNode(text: "20 Runden") - text3.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) - - node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 220) - node3.zPosition = 4 - - text4 = SKLabelNode(text: "Nach jeder Runde kämpfen die\ngegnerischen Einheiten gegeneinander.\nWer die Basis eingenommen hat siehst\ndu an der Farbe der Basis.") - text4.position = CGPoint(x: rulesScene.size.width * 0.5 + 115, y: rulesScene.size.height * 0.2 + 10) - text4.numberOfLines = 4 - + texture = SKTexture(imageNamed:"RulesSpiel") case .Basen: - header = SKLabelNode(text: "Erklärung der Basen:") - - text1 = SKLabelNode(text: "Initialisierung") - self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) - self.text1.numberOfLines = 2 - self.text1.preferredMaxLayoutWidth = 390 - - let texture = SKTexture(imageNamed:"yellow_boxTick") - node1 = SKSpriteNode(texture: texture, size: texture.size()) - node1.setScale(2.4) - node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node1.zPosition = 4 - - text2 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") - self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 - 220, y: rulesScene.size.height * 0.8 - 100) - - node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node2.zPosition = 4 - - text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") - text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) - - node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) - node3.zPosition = 4 - - text4 = SKLabelNode(text: "20 Runden") - text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) - + texture = SKTexture(imageNamed:"RulesBasen") case .Spielende: - header = SKLabelNode(text: "Erklärung des Spielendes:") - text1 = SKLabelNode(text: "Initialisierung") - self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) - self.text1.numberOfLines = 2 - self.text1.preferredMaxLayoutWidth = 390 - - let texture = SKTexture(imageNamed:"yellow_boxTick") - node1 = SKSpriteNode(texture: texture, size: texture.size()) - node1.setScale(2.4) - node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node1.zPosition = 4 - - text2 = SKLabelNode(text: "wtf") - self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) - - node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node2.zPosition = 4 - - text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") - text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) - - node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) - node3.zPosition = 4 - - text4 = SKLabelNode(text: "20 Runden") - text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) - + texture = SKTexture(imageNamed:"RulesSpielende") case .Achievements: - header = SKLabelNode(text: "Erklärung der Achievements:") - text1 = SKLabelNode(text: "Initialisierung") - self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) - self.text1.numberOfLines = 2 - self.text1.preferredMaxLayoutWidth = 390 - - let texture = SKTexture(imageNamed:"yellow_boxTick") - node1 = SKSpriteNode(texture: texture, size: texture.size()) - node1.setScale(2.4) - node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node1.zPosition = 4 - - text2 = SKLabelNode(text: "wtf") - self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) - - node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node2.zPosition = 4 - - text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") - text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) - - node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) - node3.zPosition = 4 - - text4 = SKLabelNode(text: "20 Runden") - text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) - + texture = SKTexture(imageNamed:"RulesErfolge") case .Einheiten: - header = SKLabelNode(text: "Erklärung der Einheiten:") - text1 = SKLabelNode(text: "Initialisierung") - self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) - self.text1.numberOfLines = 2 - self.text1.preferredMaxLayoutWidth = 390 - - let texture = SKTexture(imageNamed:"yellow_boxTick") - node1 = SKSpriteNode(texture: texture, size: texture.size()) - node1.setScale(2.4) - node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node1.zPosition = 4 - - text2 = SKLabelNode(text: "wtf") - self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) - - node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node2.zPosition = 4 - - text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") - text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) - - node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) - node3.zPosition = 4 - - text4 = SKLabelNode(text: "20 Runden") - text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) - + texture = SKTexture(imageNamed:"RulesEinheiten") case .Boost: - header = SKLabelNode(text: "Erklärung der Boosts:") - text1 = SKLabelNode(text: "Initialisierung") - self.text1.position = CGPoint(x: rulesScene.size.width * 0.5 - 300 , y: rulesScene.size.height * 0.8 - 100) - self.text1.numberOfLines = 2 - self.text1.preferredMaxLayoutWidth = 390 - - let texture = SKTexture(imageNamed:"yellow_boxTick") - node1 = SKSpriteNode(texture: texture, size: CGSize(width: 5.0, height: 5.0)) - node1.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node1.zPosition = 4 - - text2 = SKLabelNode(text: "wtf") - self.text2.position = CGPoint(x: rulesScene.size.width * 0.5 , y: rulesScene.size.height * 0.8 - 500) - - node2 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node2.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 100) - node2.zPosition = 4 - - text3 = SKLabelNode(text: "30 Sekunden Zeit pro Runde") - text3.position = CGPoint(x: rulesScene.size.width * 0.5 + 25, y: rulesScene.size.height * 0.6 - 110) - - node3 = SKSpriteNode(texture: texture, size: CGSize(width: 30.0, height: 30.0) ) - node3.position = CGPoint(x: rulesScene.size.width * 0.5 - 200, y: rulesScene.size.height * 0.6 - 160) - node3.zPosition = 4 - - text4 = SKLabelNode(text: "20 Runden") - text4.position = CGPoint(x: rulesScene.size.width * 0.5 - 100, y: rulesScene.size.height * 0.6 - 170) - + texture = SKTexture(imageNamed:"RulesBoost") } - self.header.position = CGPoint(x: rulesScene.size.width * 0.5 - 100 , y: rulesScene.size.height * 0.8) - self.header.fontName = "Courier-Bold" - self.header.fontColor = .black - self.header.fontSize = 30 - self.header.zPosition = 5 - - self.text1.fontName = "Courier-Bold" - self.text1.fontColor = .black - self.text1.fontSize = 25 - self.text1.zPosition = 5 - - self.text2.fontName = "Courier-Bold" - self.text2.fontColor = .black - self.text2.fontSize = 25 - self.text2.zPosition = 5 - - self.text3.fontName = "Courier-Bold" - self.text3.fontColor = .black - self.text3.fontSize = 25 - self.text3.zPosition = 5 - - self.text4.fontName = "Courier-Bold" - self.text4.fontColor = .black - self.text4.fontSize = 25 - self.text4.zPosition = 5 - - super.init() - - /* overlay = SKSpriteNode(color: UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.7), size: menuScene.size) - overlay.anchorPoint = menuScene.anchorPoint - overlay.zPosition = 3 */ + node1 = SKSpriteNode(texture: texture, size: CGSize(width: rulesScene.size.width * 0.8, height: rulesScene.size.height * 0.8)) + node1.position = CGPoint(x: rulesScene.size.width * 0.6, y: rulesScene.size.height * 0.6 - 150) + node1.zPosition = 4 +super.init() } required init?(coder: NSCoder) {