implement RoundIncrement feature

This commit is contained in:
127-Z3R0 2020-06-02 20:52:11 +02:00
parent 48361738ba
commit 028282f784
3 changed files with 8 additions and 2 deletions

View File

@ -150,7 +150,7 @@ class HUD: GKEntity {
backgroundRoundCounter.zPosition = 2 backgroundRoundCounter.zPosition = 2
backgroundRoundCounter.position = CGPoint(x: Double(size.width) * 0.06, y: Double(size.height) * 0.08) backgroundRoundCounter.position = CGPoint(x: Double(size.width) * 0.06, y: Double(size.height) * 0.08)
currentRoundLabel.text = "\(RoundCalculatorService.sharedInstance.roundcount)" currentRoundLabel.text = "\(RoundCalculatorService.sharedInstance.currentRound)"
currentRoundLabel.fontSize = 50 currentRoundLabel.fontSize = 50
currentRoundLabel.fontColor = SKColor.black currentRoundLabel.fontColor = SKColor.black
currentRoundLabel.verticalAlignmentMode = .center currentRoundLabel.verticalAlignmentMode = .center
@ -158,7 +158,7 @@ class HUD: GKEntity {
currentRoundLabel.zPosition = backgroundRoundCounter.zPosition + 1 currentRoundLabel.zPosition = backgroundRoundCounter.zPosition + 1
roundsLabel.zPosition = backgroundRoundCounter.zPosition + 1 roundsLabel.zPosition = backgroundRoundCounter.zPosition + 1
roundsLabel.text = "of \(RoundCalculatorService.sharedInstance.rounds)" roundsLabel.text = "of \(RoundCalculatorService.sharedInstance.MAX_ROUNDS)"
roundsLabel.fontColor = SKColor.black roundsLabel.fontColor = SKColor.black
roundsLabel.verticalAlignmentMode = .center roundsLabel.verticalAlignmentMode = .center
roundsLabel.fontSize = 12 roundsLabel.fontSize = 12

View File

@ -159,6 +159,8 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
} }
if let snapshotModel = try? jsonDecoder.decode(SnapshotModel.self, from: data) { if let snapshotModel = try? jsonDecoder.decode(SnapshotModel.self, from: data) {
DataService.sharedInstance.snapshotModel = snapshotModel DataService.sharedInstance.snapshotModel = snapshotModel
RoundCalculatorService.sharedInstance.currentRound += 1
entityManager.getHUD()?.setCurrentRound(round: RoundCalculatorService.sharedInstance.currentRound)
entityManager.updateSnapshotModel(snapshotModel: snapshotModel) entityManager.updateSnapshotModel(snapshotModel: snapshotModel)
entityManager.getHUD()?.startWithDuration() entityManager.getHUD()?.startWithDuration()
} }

View File

@ -147,6 +147,10 @@ class RoundCalculatorService {
DataService.sharedInstance.localRoundData.localPlayerMoves.removeAll() DataService.sharedInstance.localRoundData.localPlayerMoves.removeAll()
DataService.sharedInstance.localRoundData.hasAttackBoost = false DataService.sharedInstance.localRoundData.hasAttackBoost = false
DataService.sharedInstance.localRoundData.hasDefenceBoost = false DataService.sharedInstance.localRoundData.hasDefenceBoost = false
currentRound += 1
entityManager.getHUD()?.setCurrentRound(round: currentRound)
MultiplayerNetwork.sharedInstance.sendSnapshotModelToPlayers() MultiplayerNetwork.sharedInstance.sendSnapshotModelToPlayers()
DataService.sharedInstance.snapshotModel = currentSnapshotModel DataService.sharedInstance.snapshotModel = currentSnapshotModel
entityManager.updateSnapshotModel(snapshotModel: currentSnapshotModel!) entityManager.updateSnapshotModel(snapshotModel: currentSnapshotModel!)