From fae2855bf94a4b01e91fb382ecbfd2b9253aa10f Mon Sep 17 00:00:00 2001 From: Niko <> Date: Sat, 2 May 2020 22:29:16 +0200 Subject: [PATCH] stash --- GoldWars/GoldWars.xcodeproj/project.pbxproj | 24 ++++-- .../Components/BackgroundComponent.swift | 10 +++ .../GoldWars/Components/ButtonComponent.swift | 28 +++++++ GoldWars/GoldWars/Components/ButtonNode.swift | 70 +++++++++++++++++ GoldWars/GoldWars/Entities/Button.swift | 29 +++++++ .../GoldWars/Entities/EntityManager.swift | 7 ++ GoldWars/GoldWars/GameViewController.swift | 15 ++-- GoldWars/GoldWars/Scenes/GameScene.sks | Bin 4126 -> 0 bytes GoldWars/GoldWars/Scenes/MenuScene.sks | Bin 8166 -> 0 bytes GoldWars/GoldWars/Scenes/MenuScene.swift | 72 +++++++++--------- 10 files changed, 202 insertions(+), 53 deletions(-) create mode 100644 GoldWars/GoldWars/Components/BackgroundComponent.swift create mode 100644 GoldWars/GoldWars/Components/ButtonComponent.swift create mode 100644 GoldWars/GoldWars/Components/ButtonNode.swift create mode 100644 GoldWars/GoldWars/Entities/Button.swift delete mode 100644 GoldWars/GoldWars/Scenes/GameScene.sks delete mode 100644 GoldWars/GoldWars/Scenes/MenuScene.sks diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index 37f6e37..675a919 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 110360D3244B101A008610AF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110360D2244B101A008610AF /* AppDelegate.swift */; }; - 110360D5244B101A008610AF /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 110360D4244B101A008610AF /* GameScene.sks */; }; 110360D9244B101A008610AF /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110360D8244B101A008610AF /* GameScene.swift */; }; 110360DB244B101A008610AF /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110360DA244B101A008610AF /* GameViewController.swift */; }; 110360DE244B101A008610AF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 110360DC244B101A008610AF /* Main.storyboard */; }; @@ -16,13 +15,16 @@ 110360E3244B101B008610AF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 110360E1244B101B008610AF /* LaunchScreen.storyboard */; }; 110360EE244B101B008610AF /* GoldWarsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110360ED244B101B008610AF /* GoldWarsTests.swift */; }; 110360F9244B101B008610AF /* GoldWarsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110360F8244B101B008610AF /* GoldWarsUITests.swift */; }; - 11036111244B3D6A008610AF /* MenuScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 11036110244B3D6A008610AF /* MenuScene.sks */; }; 11036113244B3E30008610AF /* MenuScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11036112244B3E30008610AF /* MenuScene.swift */; }; 116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; }; 11738A3B24508F68004426F1 /* Unit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11738A3A24508F68004426F1 /* Unit.swift */; }; 3EBD242C245D8044003CECE7 /* GameCenterHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EBD242B245D8044003CECE7 /* GameCenterHelper.swift */; }; 3EBD242E245D9332003CECE7 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EBD242D245D9332003CECE7 /* Team.swift */; }; 9E11FF79245CD81100EED3BE /* Fire.sks in Resources */ = {isa = PBXBuildFile; fileRef = 9E11FF77245CD81100EED3BE /* Fire.sks */; }; + 9E174C82245DD81D00209FF0 /* ButtonNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E174C81245DD81D00209FF0 /* ButtonNode.swift */; }; + 9E174C84245DD8CE00209FF0 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E174C83245DD8CE00209FF0 /* Button.swift */; }; + 9E174C86245DD91500209FF0 /* ButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E174C85245DD91500209FF0 /* ButtonComponent.swift */; }; + 9E174C88245DF1FF00209FF0 /* BackgroundComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E174C87245DF1FF00209FF0 /* BackgroundComponent.swift */; }; 9E78ACB6245C9A5300526FF7 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E78ACB5245C9A5300526FF7 /* GameKit.framework */; }; 9E78ACB8245CB75B00526FF7 /* TeamComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */; }; 9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB9245CBDAF00526FF7 /* HUD.swift */; }; @@ -60,7 +62,6 @@ /* Begin PBXFileReference section */ 110360CF244B101A008610AF /* GoldWars.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GoldWars.app; sourceTree = BUILT_PRODUCTS_DIR; }; 110360D2244B101A008610AF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 110360D4244B101A008610AF /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = ""; }; 110360D8244B101A008610AF /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; }; 110360DA244B101A008610AF /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; 110360DD244B101A008610AF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -73,13 +74,16 @@ 110360F4244B101B008610AF /* GoldWarsUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GoldWarsUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 110360F8244B101B008610AF /* GoldWarsUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoldWarsUITests.swift; sourceTree = ""; }; 110360FA244B101B008610AF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 11036110244B3D6A008610AF /* MenuScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = MenuScene.sks; sourceTree = ""; }; 11036112244B3E30008610AF /* MenuScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuScene.swift; sourceTree = ""; }; 116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = ""; }; 11738A3A24508F68004426F1 /* Unit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Unit.swift; sourceTree = ""; }; 3EBD242B245D8044003CECE7 /* GameCenterHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameCenterHelper.swift; sourceTree = ""; }; 3EBD242D245D9332003CECE7 /* Team.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Team.swift; sourceTree = ""; }; 9E11FF77245CD81100EED3BE /* Fire.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = Fire.sks; sourceTree = ""; }; + 9E174C81245DD81D00209FF0 /* ButtonNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonNode.swift; sourceTree = ""; }; + 9E174C83245DD8CE00209FF0 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; + 9E174C85245DD91500209FF0 /* ButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonComponent.swift; sourceTree = ""; }; + 9E174C87245DF1FF00209FF0 /* BackgroundComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundComponent.swift; sourceTree = ""; }; 9E78ACB5245C9A5300526FF7 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; }; 9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TeamComponent.swift; sourceTree = ""; }; 9E78ACB9245CBDAF00526FF7 /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = ""; }; @@ -186,6 +190,7 @@ 116060F4245C56EA004E5A36 /* Components */ = { isa = PBXGroup; children = ( + 9E174C81245DD81D00209FF0 /* ButtonNode.swift */, 9EA3ABE8245C6DAA006BC61D /* DefaultBaseComponent.swift */, 9EA3ABEC245C8143006BC61D /* ModalBackgroundComponent.swift */, 9EA3ABEE245C834B006BC61D /* ModalContentComponent.swift */, @@ -194,6 +199,8 @@ 9E78ACBD245CC9C000526FF7 /* AtkBoostSkillComponent.swift */, 9E78ACC3245CCA3600526FF7 /* SpySkillComponent.swift */, 9E78ACC1245CC9EE00526FF7 /* DefBoostSkillComponent.swift */, + 9E174C85245DD91500209FF0 /* ButtonComponent.swift */, + 9E174C87245DF1FF00209FF0 /* BackgroundComponent.swift */, ); path = Components; sourceTree = ""; @@ -205,6 +212,7 @@ 9EC86B9E245C88A300796EF3 /* Modal.swift */, 116060F6245C57D2004E5A36 /* EntityManager.swift */, 9E78ACB9245CBDAF00526FF7 /* HUD.swift */, + 9E174C83245DD8CE00209FF0 /* Button.swift */, ); path = Entities; sourceTree = ""; @@ -247,10 +255,8 @@ 9EC86BA4245C8A1E00796EF3 /* Scenes */ = { isa = PBXGroup; children = ( - 11036110244B3D6A008610AF /* MenuScene.sks */, 11036112244B3E30008610AF /* MenuScene.swift */, 110360D8244B101A008610AF /* GameScene.swift */, - 110360D4244B101A008610AF /* GameScene.sks */, ); path = Scenes; sourceTree = ""; @@ -369,8 +375,6 @@ buildActionMask = 2147483647; files = ( 110360DE244B101A008610AF /* Main.storyboard in Resources */, - 11036111244B3D6A008610AF /* MenuScene.sks in Resources */, - 110360D5244B101A008610AF /* GameScene.sks in Resources */, 9E11FF79245CD81100EED3BE /* Fire.sks in Resources */, 110360E0244B101B008610AF /* Assets.xcassets in Resources */, 110360E3244B101B008610AF /* LaunchScreen.storyboard in Resources */, @@ -407,8 +411,10 @@ 110360D9244B101A008610AF /* GameScene.swift in Sources */, 116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */, 3EBD242E245D9332003CECE7 /* Team.swift in Sources */, + 9E174C88245DF1FF00209FF0 /* BackgroundComponent.swift in Sources */, 9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */, 11738A3B24508F68004426F1 /* Unit.swift in Sources */, + 9E174C86245DD91500209FF0 /* ButtonComponent.swift in Sources */, 11036113244B3E30008610AF /* MenuScene.swift in Sources */, 9EA3ABE9245C6DAA006BC61D /* DefaultBaseComponent.swift in Sources */, 9EA3ABED245C8143006BC61D /* ModalBackgroundComponent.swift in Sources */, @@ -416,6 +422,8 @@ AB1D759C245DD18100671525 /* MapProtocoll.swift in Sources */, AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */, ABA03DA0244BD54F00A66916 /* Base.swift in Sources */, + 9E174C82245DD81D00209FF0 /* ButtonNode.swift in Sources */, + 9E174C84245DD8CE00209FF0 /* Button.swift in Sources */, 110360DB244B101A008610AF /* GameViewController.swift in Sources */, 110360D3244B101A008610AF /* AppDelegate.swift in Sources */, 9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */, diff --git a/GoldWars/GoldWars/Components/BackgroundComponent.swift b/GoldWars/GoldWars/Components/BackgroundComponent.swift new file mode 100644 index 0000000..49244c0 --- /dev/null +++ b/GoldWars/GoldWars/Components/BackgroundComponent.swift @@ -0,0 +1,10 @@ +// +// BackgroundComponent.swift +// GoldWars +// +// Created by Niko Jochim on 02.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import Foundation + diff --git a/GoldWars/GoldWars/Components/ButtonComponent.swift b/GoldWars/GoldWars/Components/ButtonComponent.swift new file mode 100644 index 0000000..57476db --- /dev/null +++ b/GoldWars/GoldWars/Components/ButtonComponent.swift @@ -0,0 +1,28 @@ +// +// ButtonComponent.swift +// GoldWars +// +// Created by Niko Jochim on 02.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import Foundation +import GameplayKit + +class ButtonComponent: GKComponent { + + var buttonNode : ButtonNode + + init(iconName: String, text: String, position: CGPoint, isEnabled:Bool , onButtonPress: @escaping () -> ()) { + buttonNode = ButtonNode(iconName: iconName, + text: text, + isEnabled: isEnabled, + position: position, + onButtonPress: onButtonPress) + super.init() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/GoldWars/GoldWars/Components/ButtonNode.swift b/GoldWars/GoldWars/Components/ButtonNode.swift new file mode 100644 index 0000000..be4176c --- /dev/null +++ b/GoldWars/GoldWars/Components/ButtonNode.swift @@ -0,0 +1,70 @@ +// +// ButtonNode.swift +// GoldWars +// +// Created by Niko Jochim on 01.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import Foundation +import SpriteKit + +class ButtonNode : SKSpriteNode { + + var isEnabled:Bool + + let onButtonPress: () -> () + + init(iconName: String, text: String,isEnabled:Bool, position: CGPoint, onButtonPress: @escaping () -> ()) { + + self.onButtonPress = onButtonPress + self.isEnabled = isEnabled + let texture = SKTexture(imageNamed: "yellow_button04") + super.init(texture: texture, color: SKColor.white, size: texture.size()) + self.position = position + + let label = SKLabelNode(fontNamed: "Courier-Bold") + + label.fontSize = 30 + label.fontColor = SKColor.black + + label.zPosition = 1 + label.verticalAlignmentMode = .center + label.text = text + label.name = "label" + + if !iconName.isEmpty { + label.position = CGPoint(x: size.width * 0.25, y: 0) + let icon = SKSpriteNode(imageNamed: iconName) + icon.position = CGPoint(x: -size.width * 0.25, y: 0) + icon.zPosition = 1 + self.addChild(icon) + } else { + label.position = CGPoint(x: 0, y: 0) + } + self.addChild(label) + isUserInteractionEnabled = true + } + + override func touchesBegan(_ touches: Set, with event: UIEvent?) { + + if isEnabled { + let action = SKAction.sequence( + [ + SKAction.scale(by: (3/4), duration: 0.3), + SKAction.scale(by: (4/3), duration: 0.3), + ]) + + self.childNode(withName: "label")?.run(action) + self.run(action) + onButtonPress() + } + + } + + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} diff --git a/GoldWars/GoldWars/Entities/Button.swift b/GoldWars/GoldWars/Entities/Button.swift new file mode 100644 index 0000000..e2c52e2 --- /dev/null +++ b/GoldWars/GoldWars/Entities/Button.swift @@ -0,0 +1,29 @@ +// +// Button.swift +// GoldWars +// +// Created by Niko Jochim on 02.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import Foundation +import GameKit + +class Button : GKEntity{ + let name : String + var isEnabled = true + + init(name: String, iconName: String, text: String, position: CGPoint, onButtonPress: @escaping () -> ()) { + self.name = name + super.init() + self.addComponent(ButtonComponent(iconName: iconName, text: text,position: position, isEnabled: isEnabled, onButtonPress: onButtonPress)) + } + + + + 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 8f94ce6..0c9ff60 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -50,6 +50,9 @@ class EntityManager { scene.addChild(skill.shapeNode) scene.addChild(skill.labelNode) } + if let buttonNode = entity.component(ofType: ButtonComponent.self)?.buttonNode { + scene.addChild(buttonNode) + } } @@ -85,4 +88,8 @@ class EntityManager { func baseNode(for team: Team) -> SKSpriteNode?{ return base(for: team)?.component(ofType: DefaultBaseComponent.self)?.spriteNode } + + func getButtonByName(buttonName:String) -> Button{ + return entities.filter{($0 as! Button).name == buttonName}[0] as! Button + } } diff --git a/GoldWars/GoldWars/GameViewController.swift b/GoldWars/GoldWars/GameViewController.swift index 158c6de..4eed433 100644 --- a/GoldWars/GoldWars/GameViewController.swift +++ b/GoldWars/GoldWars/GameViewController.swift @@ -16,17 +16,16 @@ class GameViewController: UIViewController { super.viewDidLoad() if let view = self.view as! SKView? { - if let scene = SKScene(fileNamed: "MenuScene") { - scene.scaleMode = .aspectFill - view.presentScene(scene) - //TODO: create dev profile or remove on delivery - view.showsFPS = true - view.showsNodeCount = true - } - } + let scene = MenuScene(size: self.view.bounds.size) + scene.scaleMode = .aspectFill + view.presentScene(scene) + //TODO: create dev profile or remove on delivery + view.showsFPS = true + view.showsNodeCount = true GameCenterHelper.helper.viewController = self } + } override var shouldAutorotate: Bool { return true diff --git a/GoldWars/GoldWars/Scenes/GameScene.sks b/GoldWars/GoldWars/Scenes/GameScene.sks deleted file mode 100644 index ebf306afa8e8897c9ce187eaebeb9ac81f51cb73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4126 zcmaJ^33wFM9sj@Gw=+9OU^xWB8Iph;AuIu6I0SNVMnYsE8$yy{vO7tJYn;fA9T| z-~0XFG$dlWl?(=t009qpfr1Y>;GuVQZkuLWx)EQNtD2E!9lw_3CXGaOuFc%#8)u$hdoS*&bZpd9)@U(jJCB;XoY z1*@SQ*1#R`3%C=03G3lka2MPS_rL~t5T1oy@Ekl3FTl(23cL!h!vS~;4#5#P3LnC8 zFyJHj7*4_;i9kfsgY<^8qz@TRvPllfC8Nk_l1IjoLNbNSATvoRnM3B21*C#3Az`wd z)RShSla-`}#7OJX+;}P$I}sQImq9=14+9_*2Erg13`1Zj41+8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R2euTuXpQ_jR+4, with event: UIEvent?) { - guard let touch = touches.first else { - return + func backgroundInit(){ + for i in 0...2 { + let sky = SKSpriteNode(imageNamed: "SkyBackground") + sky.name = "clouds" + sky.zPosition = -1 + sky.size = CGSize(width: self.size.width, height: self.size.height) + sky.position = CGPoint(x: CGFloat(i) * sky.size.width , y: (self.frame.size.height / 2)) + + self.addChild(sky) } - let gameScene = GameScene(size: self.size) - let location = touch.location(in: self) - let frontTouchedNode = atPoint(location).name - + } + + func loadScene(scene: SKScene) { let transition = SKTransition.moveIn(with: .right, duration: 1) - - if frontTouchedNode == "startGameBtn" || frontTouchedNode == "tmpStartGameLbl"{ - self.view?.presentScene(gameScene, transition: transition) - } - - if frontTouchedNode == "settingsBtn" || frontTouchedNode == "tmpSettingsLbl"{ - //TODO: Implement settings functionality - } + self.view?.presentScene(scene, transition: transition) } override func update(_ currentTime: TimeInterval) { @@ -54,16 +61,7 @@ class MenuScene: SKScene { node.position.x += (self.scene?.size.width)! * 3 } })) - - // TODO: Notfalllösung - if(!GameCenterHelper.isAuthenticated) { - let authLabel = SKLabelNode(text: "You are not logged in to Gamecenter. Please login via GameCenterApp") - authLabel.name = "authLabel" - authLabel.zPosition = 2 - authLabel.position = CGPoint(x: self.size.width / 2, y: self.size.height / 5) - self.addChild(authLabel) - } else { - self.childNode(withName: "authLabel")?.removeFromParent() - } + + entityManager.getButtonByName(buttonName: "startGameButton").isEnabled = GameCenterHelper.isAuthenticated } }