deleted comments

This commit is contained in:
Chauntalle Schüle 2020-06-02 02:48:13 +02:00
parent 35ff2208fb
commit c4a4a8f755
7 changed files with 6 additions and 45 deletions

View File

@ -110,7 +110,6 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
}
func match(_ match: GKMatch, didReceive data: Data, fromRemotePlayer player: GKPlayer) {
print("I am here")
if myMatch != match { return }
let jsonDecoder = JSONDecoder()
if let randomNumberFromPeer = try? jsonDecoder.decode(RandomNumber.self, from: data) {
@ -171,14 +170,12 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
DataService.sharedInstance.addRemotePlayerMoves(playerName: player.displayName, localRoundData: roundData)
}
if let snapshotModel = try? jsonDecoder.decode(SnapshotModel.self, from: data) {
print("entered syncing state in match")
StateManager.sharedInstance.changeState(wantedState: .syncingSt)
DataService.sharedInstance.snapshotModel = snapshotModel
RoundCalculatorService.sharedInstance.currentRound += 1
entityManager.getHUD()?.setCurrentRound(round: RoundCalculatorService.sharedInstance.currentRound)
entityManager.updateSnapshotModel(snapshotModel: snapshotModel)
entityManager.getHUD()?.startWithDuration()
print("entered gameSt in match snapshot")
StateManager.sharedInstance.changeState(wantedState: .gameSt)
}
if let mapModel = try? jsonDecoder.decode(MapGenerationModel.self, from: data) {
@ -252,7 +249,6 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
}
func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFind match: GKMatch) {
print("entered syncing state in didfindmatch")
StateManager.sharedInstance.changeState(wantedState: .syncingSt)
viewController.dismiss(animated: true, completion: nil)
myMatch = match

View File

@ -25,20 +25,14 @@ class RoundCalculatorService {
var isCalculating = false
var numberOfAttacks = 0
var numberOfOwnUnitMoves = 0
var roundNr = 1
func calculateRound() {
roundNr += 1
print("roundNR \(roundNr)")
print("entered syncingSt in calculateRound")
StateManager.sharedInstance.changeState(wantedState: .syncingSt)
os_log("Started calculating Round", log: RoundCalculatorService.LOG, type: .info)
roundNr += 1
isCalculating = true
let currentSnapshotModel = DataService.sharedInstance.snapshotModel
var baseSpecificMoves = collectBaseSpecificMoves()
// TODO: Refactor to a less complex way
@ -177,7 +171,6 @@ class RoundCalculatorService {
entityManager.updateSnapshotModel(snapshotModel: currentSnapshotModel!)
entityManager.getHUD()?.startWithDuration()
os_log("Finished calculating Round", log: RoundCalculatorService.LOG, type: .info)
print("entered gameSt in calculateRound")
StateManager.sharedInstance.changeState(wantedState: .gameSt)
}

View File

@ -73,9 +73,6 @@ class GameScene: SKScene{
override func update(_ currentTime: TimeInterval) {
StateManager.sharedInstance.stateMachine!.update(deltaTime: currentTime)
/* entityManager.getBackground()?.update(deltaTime: currentTime)
entityManager.getHUD()?.component(ofType: TimerComponent.self)?.update()
*/
}
func addBaseDetails(touchLocation: CGPoint, spriteNode: SKNode?, touches: Set<UITouch>, event: UIEvent?, entity: GKEntity){

View File

@ -26,7 +26,6 @@ class MenuScene: SKScene {
onButtonPress: {
if CommandLine.arguments.contains("--no-matchmaking") {
StateManager.sharedInstance.changeState(wantedState: .gameSt)
/*self.loadScene(scene: GameScene(size: self.size))*/
SoundManager.sharedInstance.stopMenuMusic()
} else {
if GameCenterManager.isAuthenticated {
@ -71,16 +70,6 @@ class MenuScene: SKScene {
override func update(_ currentTime: TimeInterval) {
StateManager.sharedInstance.stateMachine!.update(deltaTime: currentTime)
/*
if entityManager.entities.count != 0 {
entityManager.getBackground()!.update(deltaTime: currentTime)
entityManager.getButtonByName(buttonName: "startGameButton").component(ofType: ButtonComponent.self)?.buttonNode.isEnabled = GameCenterManager.isAuthenticated
}
if GameCenterManager.sharedInstance.initIsFinish {
self.loadScene(scene: GameCenterManager.sharedInstance.gameScene!)
}
*/
}
}

View File

@ -12,7 +12,7 @@ import os
class GameState: GKState {
let LOG = OSLog.init(subsystem: "GameState", category: "GameState")
var aufruf = 0
var roundNr = RoundCalculatorService.sharedInstance.roundNr
override func isValidNextState(_ stateClass: AnyClass) -> Bool {
return stateClass is SyncingState.Type
@ -20,13 +20,12 @@ class GameState: GKState {
override func didEnter(from previousState: GKState?) {
os_log("Entered Game State", log: LOG, type: .info)
if CommandLine.arguments.contains("--no-matchmaking") {
if CommandLine.arguments.contains("--no-matchmaking"){
StateManager.sharedInstance.menuSc!.loadScene(scene: GameScene(size: StateManager.sharedInstance.menuSc!.size))
}
if aufruf == 0{
if roundNr == 1{
StateManager.sharedInstance.menuSc!.loadScene(scene: StateManager.sharedInstance.gameSc!)
}
aufruf += 1
}
override func update(deltaTime seconds: TimeInterval) {

View File

@ -26,12 +26,6 @@ class MenuState: GKState {
menuEM.getBackground()!.update(deltaTime: seconds)
menuEM.getButtonByName(buttonName: "startGameButton").component(ofType: ButtonComponent.self)?.buttonNode.isEnabled = GameCenterManager.isAuthenticated
}
// if GameCenterManager.sharedInstance.initIsFinish {
// StateManager.sharedInstance.menuSc!.loadScene(scene: GameCenterManager.sharedInstance.gameScene!)
// }
}
override func didEnter(from previousState: GKState?) {

View File

@ -82,13 +82,6 @@ class StateManager{
stateMachine = GKStateMachine(states: [menuSt, syncingSt, playingSt, endGameSt])
}
/* func changeState(wantedState: StateTypes, menuSc: MenuScene?, gameVC: GameViewController?){
self.wantedState = wantedState
self.menuSc = menuSc
self.gameVC = gameVC
enterState()
}*/
func changeState(wantedState: StateTypes){
self.wantedState = wantedState
enterState()