diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index 16d16f9..d42f8be 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -50,6 +50,7 @@ AB671B252494ECF0003FBE8D /* EloHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB671B242494ECF0003FBE8D /* EloHelper.swift */; }; ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; }; ABC0C3732481509300387B8F /* MapUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0C3722481509300387B8F /* MapUtils.swift */; }; + AE0C8E2F249BCC2A00996360 /* RulesScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0C8E2E249BCC2A00996360 /* RulesScene.swift */; }; C04783EE2468583F004961FB /* intro-music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C04783ED2468583F004961FB /* intro-music.mp3 */; }; C04783F024685995004961FB /* SettingsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04783EF24685995004961FB /* SettingsScene.swift */; }; C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05BB9C3247D890C00411249 /* SliderComponent.swift */; }; @@ -119,6 +120,7 @@ AB671B242494ECF0003FBE8D /* EloHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EloHelper.swift; sourceTree = ""; }; ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = ""; }; ABC0C3722481509300387B8F /* MapUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapUtils.swift; sourceTree = ""; }; + AE0C8E2E249BCC2A00996360 /* RulesScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RulesScene.swift; sourceTree = ""; }; C04783ED2468583F004961FB /* intro-music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "intro-music.mp3"; sourceTree = ""; }; C04783EF24685995004961FB /* SettingsScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScene.swift; sourceTree = ""; }; C05BB9C3247D890C00411249 /* SliderComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderComponent.swift; sourceTree = ""; }; @@ -194,6 +196,7 @@ C04783EF24685995004961FB /* SettingsScene.swift */, 3EAD889424801B6A0048A10A /* RoundTimer.swift */, AB671B242494ECF0003FBE8D /* EloHelper.swift */, + AE0C8E2E249BCC2A00996360 /* RulesScene.swift */, ); path = GoldWars; sourceTree = ""; @@ -432,6 +435,7 @@ C064E9A8246C0EA50022B228 /* LabelNode.swift in Sources */, 8B9CA5F1249A3C2E00561704 /* SkillButtonNode.swift in Sources */, 3EAD889524801B6A0048A10A /* RoundTimer.swift in Sources */, + AE0C8E2F249BCC2A00996360 /* RulesScene.swift in Sources */, 3E67854024728368007B9DE4 /* CElements.swift in Sources */, ABA03DA0244BD54F00A66916 /* Base.swift in Sources */, C064E9AC246C151F0022B228 /* Label.swift in Sources */, diff --git a/GoldWars/GoldWars/Assets.xcassets/Credits.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/Credits.imageset/Contents.json new file mode 100644 index 0000000..bdb8e88 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/Credits.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Credits.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/Credits.imageset/Credits.png b/GoldWars/GoldWars/Assets.xcassets/Credits.imageset/Credits.png new file mode 100644 index 0000000..64c5fa9 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/Credits.imageset/Credits.png differ 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..d21ff99 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..b639e2e 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..b5fe893 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..dcdf897 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..1485e4a 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..cf1bdad Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/RulesSpielende.imageset/RulesSpielende.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/questionmark.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/questionmark.imageset/Contents.json new file mode 100644 index 0000000..79eca12 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/questionmark.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "questionmark.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/questionmark.imageset/questionmark.png b/GoldWars/GoldWars/Assets.xcassets/questionmark.imageset/questionmark.png new file mode 100644 index 0000000..a38dc5c Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/questionmark.imageset/questionmark.png differ diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index b6a5f36..32443ff 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -15,6 +15,7 @@ class EntityManager { static let gameEMInstance = EntityManager() static let menuEMInstance = EntityManager() static let settingsEMInstance = EntityManager() + static let rulesEMInstance = EntityManager() var entities = Set() var scene: SKScene diff --git a/GoldWars/GoldWars/RulesScene.swift b/GoldWars/GoldWars/RulesScene.swift new file mode 100644 index 0000000..2c8e064 --- /dev/null +++ b/GoldWars/GoldWars/RulesScene.swift @@ -0,0 +1,118 @@ +// +// RulesScene.swift +// GoldWars +// +// Created by Chauntalle Schüle on 18.06.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import SpriteKit +import GameplayKit + +class RulesScene: SKScene { + + var image: SKSpriteNode? + + override func sceneDidLoad() { + EntityManager.rulesEMInstance.setScene(scene: self) + EntityManager.rulesEMInstance.add( + Button(name: "backToMenuScene", + textureName: "questionmark", + text: "", + position: CGPoint(x: self.size.width - 50, y: self.size.height - 50), + onButtonPress: { + EntityManager.rulesEMInstance.entities.removeAll() + self.view?.presentScene( + MenuScene(size: self.size), + transition: SKTransition.flipVertical(withDuration: 0.5) + ) + } + ) + ) + + EntityManager.rulesEMInstance.add( + Label(fontnamed: "Courier-Bold", + name: "rulesLabel", + text: "Regelwerk", + fontSize: 90, + fontColor: .black, + position: CGPoint(x: self.size.width * 0.5, y: self.size.height - 100), + horizontalAlignmentMode: .center, + vertikalAligmentMode: .baseline, + isAnimationEnabled: true, + isAnimationInfinite: true + ) + ) + + image = SKSpriteNode(imageNamed: "RulesSpiel") + image!.size = CGSize(width: size.width * 0.8, height: size.height * 0.8) + image!.position = CGPoint(x: size.width * 0.6, y: size.height * 0.6 - 150) + image!.zPosition = 4 + + self.addChild(image!) + + EntityManager.rulesEMInstance.add( + Button(name: "Spiel", + textureName: "yellow_button13", + text: "Spiel", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 + 150), + onButtonPress: { self.image!.texture = SKTexture(imageNamed: "RulesSpiel") } + ) + ) + EntityManager.rulesEMInstance.add( + Button(name: "Basen", + textureName: "yellow_button13", + text: "Basen", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 + 85), + onButtonPress: { self.image!.texture = SKTexture(imageNamed: "RulesBasen") } + ) + ) + EntityManager.rulesEMInstance.add( + Button(name: "Einheiten", + textureName: "yellow_button13", + text: "Einheiten", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 + 20), + onButtonPress: { self.image!.texture = SKTexture(imageNamed: "RulesEinheiten") } + ) + ) + EntityManager.rulesEMInstance.add( + Button(name: "Spielende", + textureName: "yellow_button13", + text: "Spielende", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 - 45), + onButtonPress: { self.image!.texture = SKTexture(imageNamed: "RulesSpielende") } + ) + ) + EntityManager.rulesEMInstance.add( + Button(name: "Boost", + textureName: "yellow_button13", + text: "Boost", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 - 110), + onButtonPress: { self.image!.texture = SKTexture(imageNamed: "RulesBoost") } + ) + ) + EntityManager.rulesEMInstance.add( + Button(name: "Erfolge", + textureName: "yellow_button13", + text: "Erfolge", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.5 - 175), + onButtonPress: { self.image!.texture = SKTexture(imageNamed: "RulesErfolge") } + ) + ) + EntityManager.rulesEMInstance.add( + Button(name: "Credits", + textureName: "yellow_button13", + text: "Credits", + position: CGPoint(x: self.size.width * 0.1, y: self.size.height * 0.1 - 20), + onButtonPress: { self.image!.texture = SKTexture(imageNamed: "Credits") } + ) + ) + EntityManager.rulesEMInstance.add(Background(size: self.size)) + } + + override func update(_ currentTime: TimeInterval) { + if EntityManager.rulesEMInstance.entities.count != 0 { + EntityManager.rulesEMInstance.getBackground()!.update(deltaTime: currentTime) + } + } +} diff --git a/GoldWars/GoldWars/Scenes/MenuScene.swift b/GoldWars/GoldWars/Scenes/MenuScene.swift index b53399c..94fdc9c 100644 --- a/GoldWars/GoldWars/Scenes/MenuScene.swift +++ b/GoldWars/GoldWars/Scenes/MenuScene.swift @@ -53,6 +53,14 @@ class MenuScene: SKScene { GameCenterManager.sharedInstance.authUser() } })) + entityManager.add(Button(name: "regelwerkButton", + textureName: "questionmark", + text: "", + position: CGPoint(x: self.size.width - 50, y: self.size.height - 50), + onButtonPress: { + let scene = RulesScene(size: self.size) + self.loadScene(scene: scene) + })) entityManager.add(Background(size: self.size)) entityManager.add(SpinningLogoEntity(sceneSize: self.size))