diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index ba4f9b5..8b35a21 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -41,6 +41,8 @@ 9EC7E48B2461FBF700396BCD /* SliderNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC7E48A2461FBF700396BCD /* SliderNode.swift */; }; 9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC86B9E245C88A300796EF3 /* Modal.swift */; }; 9EC86BA6245C8AD000796EF3 /* ModalType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC86BA5245C8AD000796EF3 /* ModalType.swift */; }; + 9EEDE02D246FCD770096C735 /* SpinningLogoEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */; }; + 9EEDE02F246FCD800096C735 /* SpinningLogoComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEDE02E246FCD800096C735 /* SpinningLogoComponent.swift */; }; AB1D759C245DD18100671525 /* MapProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759A245DD18100671525 /* MapProtocol.swift */; }; AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */; }; AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759F245DEC0500671525 /* MapFactory.swift */; }; @@ -104,6 +106,8 @@ 9EC86B9E245C88A300796EF3 /* Modal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Modal.swift; sourceTree = ""; }; 9EC86BA5245C8AD000796EF3 /* ModalType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalType.swift; sourceTree = ""; }; 9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GoldWars.entitlements; sourceTree = ""; }; + 9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinningLogoEntity.swift; sourceTree = ""; }; + 9EEDE02E246FCD800096C735 /* SpinningLogoComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinningLogoComponent.swift; sourceTree = ""; }; AB1D759A245DD18100671525 /* MapProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapProtocol.swift; sourceTree = ""; }; AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TwoPlayerDefaultTestMap.swift; sourceTree = ""; }; AB1D759F245DEC0500671525 /* MapFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapFactory.swift; sourceTree = ""; }; @@ -194,6 +198,7 @@ 116060F4245C56EA004E5A36 /* Components */ = { isa = PBXGroup; children = ( + 9EEDE02E246FCD800096C735 /* SpinningLogoComponent.swift */, 9E174C81245DD81D00209FF0 /* ButtonNode.swift */, 9EA3ABE8245C6DAA006BC61D /* DefaultBaseComponent.swift */, 9EA3ABEC245C8143006BC61D /* ModalBackgroundComponent.swift */, @@ -216,6 +221,7 @@ 116060F5245C5709004E5A36 /* Entities */ = { isa = PBXGroup; children = ( + 9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */, ABA03D9F244BD54F00A66916 /* Base.swift */, 9EC86B9E245C88A300796EF3 /* Modal.swift */, 116060F6245C57D2004E5A36 /* EntityManager.swift */, @@ -397,6 +403,7 @@ 3EBD242E245D9332003CECE7 /* Team.swift in Sources */, 9E174C88245DF1FF00209FF0 /* BackgroundComponent.swift in Sources */, 9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */, + 9EEDE02D246FCD770096C735 /* SpinningLogoEntity.swift in Sources */, 11738A3B24508F68004426F1 /* Unit.swift in Sources */, 9E174C86245DD91500209FF0 /* ButtonComponent.swift in Sources */, AE151589245F18EF001D363E /* MatchmakingHelper.swift in Sources */, @@ -414,6 +421,7 @@ C064E9AC246C151F0022B228 /* Label.swift in Sources */, 9E174C82245DD81D00209FF0 /* ButtonNode.swift in Sources */, 9EC7E48B2461FBF700396BCD /* SliderNode.swift in Sources */, + 9EEDE02F246FCD800096C735 /* SpinningLogoComponent.swift in Sources */, 9E174C84245DD8CE00209FF0 /* Button.swift in Sources */, 110360DB244B101A008610AF /* GameViewController.swift in Sources */, 2086465C2461B66200817C23 /* TimerComponent.swift in Sources */, @@ -616,7 +624,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "Developer Profile"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 2; }; diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/Contents.json new file mode 100644 index 0000000..72ffd48 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "logo_kante.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "logo_kante-1.jpg", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "logo_kante-2.jpg", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-1.jpg b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-1.jpg new file mode 100644 index 0000000..1ef166f Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-1.jpg differ diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-2.jpg b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-2.jpg new file mode 100644 index 0000000..1ef166f Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-2.jpg differ diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante.jpg b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante.jpg new file mode 100644 index 0000000..1ef166f Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante.jpg differ diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/Contents.json b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/Contents.json new file mode 100644 index 0000000..8401033 --- /dev/null +++ b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "logo_no_background.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "logo_no_background-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "logo_no_background-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-1.png b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-1.png new file mode 100644 index 0000000..07b8c65 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-1.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-2.png b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-2.png new file mode 100644 index 0000000..07b8c65 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-2.png differ diff --git a/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background.png b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background.png new file mode 100644 index 0000000..07b8c65 Binary files /dev/null and b/GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background.png differ diff --git a/GoldWars/GoldWars/Components/SpinningLogoComponent.swift b/GoldWars/GoldWars/Components/SpinningLogoComponent.swift new file mode 100644 index 0000000..ab01672 --- /dev/null +++ b/GoldWars/GoldWars/Components/SpinningLogoComponent.swift @@ -0,0 +1,45 @@ +// +// SpinningLogoComponent.swift +// GoldWars +// +// Created by Niko Jochim on 15.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import Foundation +import GameKit + +class SpinningLogoComponent: GKComponent{ + + var node : SK3DNode + + init(position: CGPoint) { + + let scnScene: SCNScene = { + let scnScene = SCNScene() + let cylinder = SCNCylinder(radius: 250, height: 50) + let logoMaterial = SCNMaterial() + let colorMaterial = SCNMaterial() + logoMaterial.diffuse.contents = UIImage(named: "logo_no_background") + colorMaterial.diffuse.contents = UIColor(red: 0.852, green: 0.649, blue: 0.123, alpha: 1) + cylinder.materials = [colorMaterial,logoMaterial,logoMaterial] + let cylinderNode = SCNNode(geometry: cylinder) + cylinderNode.eulerAngles = SCNVector3(x: Float(CGFloat.pi / 2), y: 0, z: Float(CGFloat.pi / 2)) + let action = SCNAction.rotateBy(x: CGFloat(GLKMathDegreesToRadians(360)), y:0 , z: 0, duration: 8) + let forever = SCNAction.repeatForever(action) + cylinderNode.runAction(forever) + scnScene.rootNode.addChildNode(cylinderNode) + return scnScene + }() + + self.node = SK3DNode(viewportSize: CGSize(width: 250, height: 250)) + node.scnScene = scnScene + node.position = position + super.init() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 6afa00e..c66482d 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -68,6 +68,9 @@ class EntityManager { if let labelNode = entity.component(ofType: LabelComponent.self)?.labelNode { scene.addChild(labelNode) } + if let node = entity.component(ofType: SpinningLogoComponent.self)?.node { + scene.addChild(node) + } } func remove(_ entity: GKEntity) { @@ -100,9 +103,9 @@ class EntityManager { if base.changeOwnership { base.addComponent(TeamComponent( - team: (entities[0] as! Base).component(ofType: TeamComponent.self)!.team, - player: (entities[0] as! Base).component(ofType: TeamComponent.self)!.player, - position: (base.component(ofType: DefaultBaseComponent.self)?.spriteNode.position)! + team: (entities[0] as! Base).component(ofType: TeamComponent.self)!.team, + player: (entities[0] as! Base).component(ofType: TeamComponent.self)!.player, + position: (base.component(ofType: DefaultBaseComponent.self)?.spriteNode.position)! ) ) base.changeOwnership = false diff --git a/GoldWars/GoldWars/Entities/SpinningLogoEntity.swift b/GoldWars/GoldWars/Entities/SpinningLogoEntity.swift new file mode 100644 index 0000000..0e84923 --- /dev/null +++ b/GoldWars/GoldWars/Entities/SpinningLogoEntity.swift @@ -0,0 +1,22 @@ +// +// SpinningLogoEntity.swift +// GoldWars +// +// Created by Niko Jochim on 15.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import Foundation +import GameplayKit + +class SpinningLogoEntity: GKEntity { + + init(position: CGPoint) { + super.init() + self.addComponent(SpinningLogoComponent(position: position)) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/GoldWars/GoldWars/Scenes/MenuScene.swift b/GoldWars/GoldWars/Scenes/MenuScene.swift index bca03d2..2d86084 100644 --- a/GoldWars/GoldWars/Scenes/MenuScene.swift +++ b/GoldWars/GoldWars/Scenes/MenuScene.swift @@ -7,11 +7,11 @@ // import SpriteKit - +import SceneKit class MenuScene: SKScene { - + var entityManager: EntityManager! - + override func sceneDidLoad() { entityManager = EntityManager(scene: self) let midX = self.size.width / 2 @@ -25,9 +25,9 @@ class MenuScene: SKScene { self.loadScene(scene: GameScene(size: self.size)) SoundManager.sharedInstance.stopMenuMusic() } else { - MatchmakingHelper.sharedInstance.presentMatchmaker(scene: self) + MatchmakingHelper.sharedInstance.presentMatchmaker(scene: self) } - })) + })) entityManager.add(Button(name: "settingsButton", iconName: "", text: "Settings", @@ -36,17 +36,18 @@ class MenuScene: SKScene { self.loadScene(scene: SettingsScene(size: self.size)) })) entityManager.add(Background(size: self.size)) + entityManager.add(SpinningLogoEntity(position: CGPoint(x: midX, y: midY + 200))) if SoundManager.sharedInstance.isMusicPlaying == false && SoundManager.sharedInstance.isMusicEnabled == true { SoundManager.sharedInstance.startMenuMusic() } } - + func loadScene(scene: SKScene) { let transition = SKTransition.flipVertical(withDuration: 0.5) self.view?.presentScene(scene, transition: transition) } - + override func update(_ currentTime: TimeInterval) { entityManager.getBackground()!.update(deltaTime: currentTime) entityManager.getButtonByName(buttonName: "startGameButton").component(ofType: ButtonComponent.self)?.buttonNode.isEnabled = GameCenterHelper.isAuthenticated