From d7d17dba2bca5d121ed6f23f6d05faa14b8ee129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chauntalle=20Schu=CC=88le?= Date: Fri, 29 May 2020 01:11:42 +0200 Subject: [PATCH] added MenuState, is initial State --- GoldWars/GoldWars.xcodeproj/project.pbxproj | 6 +++++ GoldWars/GoldWars/MenuState.swift | 29 +++++++++++++++++++++ GoldWars/GoldWars/StateTypes.swift | 27 ------------------- 3 files changed, 35 insertions(+), 27 deletions(-) create mode 100644 GoldWars/GoldWars/MenuState.swift diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index bae179d..5d102f2 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -46,6 +46,9 @@ AB21D7D5246C748A00B09CBA /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB21D7D4246C748A00B09CBA /* MapFactory.swift */; }; ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; }; ABC0C3732481509300387B8F /* MapUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0C3722481509300387B8F /* MapUtils.swift */; }; + AE6BB1C0248030720063ECAE /* StateTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1BF248030720063ECAE /* StateTypes.swift */; }; + AE6BB1C224807AC00063ECAE /* StateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C124807AC00063ECAE /* StateManager.swift */; }; + AE6BB1C424807C490063ECAE /* MenuState.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C324807C490063ECAE /* MenuState.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 */; }; @@ -113,6 +116,7 @@ ABC0C3722481509300387B8F /* MapUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapUtils.swift; sourceTree = ""; }; AE6BB1BF248030720063ECAE /* StateTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateTypes.swift; sourceTree = ""; }; AE6BB1C124807AC00063ECAE /* StateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateManager.swift; sourceTree = ""; }; + AE6BB1C324807C490063ECAE /* MenuState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuState.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 = ""; }; @@ -186,6 +190,7 @@ 3EAD889424801B6A0048A10A /* RoundTimer.swift */, AE6BB1BF248030720063ECAE /* StateTypes.swift */, AE6BB1C124807AC00063ECAE /* StateManager.swift */, + AE6BB1C324807C490063ECAE /* MenuState.swift */, ); path = GoldWars; sourceTree = ""; @@ -404,6 +409,7 @@ C04783F024685995004961FB /* SettingsScene.swift in Sources */, 116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */, C064E9AA246C114C0022B228 /* LabelComponent.swift in Sources */, + AE6BB1C424807C490063ECAE /* MenuState.swift in Sources */, 3EBD242E245D9332003CECE7 /* Team.swift in Sources */, 9E174C88245DF1FF00209FF0 /* BackgroundComponent.swift in Sources */, 9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */, diff --git a/GoldWars/GoldWars/MenuState.swift b/GoldWars/GoldWars/MenuState.swift new file mode 100644 index 0000000..a7d41fa --- /dev/null +++ b/GoldWars/GoldWars/MenuState.swift @@ -0,0 +1,29 @@ +// +// MenuState.swift +// GoldWars +// +// Created by Chauntalle Schüle on 29.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import GameKit +import os + +class MenuState: GKState { + + let LOG = OSLog.init(subsystem: "MenuState", category: "MenuState") + + override func isValidNextState(_ stateClass: AnyClass) -> Bool { + return stateClass is SyncingState.Type + } + + override func update(deltaTime seconds: TimeInterval) { + } + + override func didEnter(from previousState: GKState?) { + os_log("Entered Menu State", log: LOG, type: .info) + } + + override func willExit(to nextState: GKState) { + } +} diff --git a/GoldWars/GoldWars/StateTypes.swift b/GoldWars/GoldWars/StateTypes.swift index 4d47c3e..b7bb86f 100644 --- a/GoldWars/GoldWars/StateTypes.swift +++ b/GoldWars/GoldWars/StateTypes.swift @@ -16,33 +16,6 @@ enum StateTypes { case endGameSt } -class MenuState: GKState { - - let LOG = OSLog.init(subsystem: "MenuState", category: "MenuState") - - override func isValidNextState(_ stateClass: AnyClass) -> Bool { - /* guard GameViewController.allowedState != States.menuSt && GameViewController.allowedState == nil else { - return false - } - if (GameViewController.allowedState == States.syncingSt){ - return stateClass is SyncingState.Type - }else { - return false - }*/ - return stateClass is SyncingState.Type - } - - override func update(deltaTime seconds: TimeInterval) { - } - - override func didEnter(from previousState: GKState?) { - os_log("Entered Menu State", log: LOG, type: .info) - } - - override func willExit(to nextState: GKState) { - } -} - class SyncingState: GKState { let LOG = OSLog.init(subsystem: "SyncingState", category: "SyncingState")