revert heartbeart for crashes
This commit is contained in:
parent
c7d9d63752
commit
e109b9d93f
@ -611,14 +611,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 4;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
||||
INFOPLIST_FILE = GoldWars/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -634,14 +634,14 @@
|
||||
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 4;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
||||
INFOPLIST_FILE = GoldWars/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -5,12 +5,6 @@
|
||||
// Created by Tim Herbst on 13.05.20.
|
||||
// Copyright © 2020 SP2. All rights reserved.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
struct Heartbeat: Codable {
|
||||
var date: Date
|
||||
}
|
||||
|
||||
struct NotificationModel: Codable {
|
||||
let name: String
|
||||
|
||||
|
@ -215,25 +215,11 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
|
||||
print("Recieved elo data: \(eloData.scoreToReport)")
|
||||
EloHelper.reportScore(score: eloData.scoreToReport)
|
||||
}
|
||||
if let heartbeat = try? jsonDecoder.decode(Heartbeat.self, from: data) {
|
||||
entityManager.getHUD()?.roundTimer.isHeartbeatLocked = false
|
||||
let df = DateFormatter()
|
||||
df.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||
let dateString = df.string(from: heartbeat.date)
|
||||
print("Received last Heartbeat at \(dateString)")
|
||||
}
|
||||
|
||||
|
||||
MultiplayerNetwork.sharedInstance.isSending = false
|
||||
}
|
||||
|
||||
func match(_ match: GKMatch, player: GKPlayer, didChange state: GKPlayerConnectionState) {
|
||||
if myMatch != match { return }
|
||||
if state == GKPlayerConnectionState.disconnected {
|
||||
self.opponentQuit = true;
|
||||
gameScene?.gameQuit()
|
||||
}
|
||||
}
|
||||
|
||||
func initAndSendMap() -> Void {
|
||||
self.gameScene = GameScene(size: self.menusc!.size)
|
||||
let mapModel = MapFactory(scene: self.gameScene!, entityManager: entityManager).load()
|
||||
|
@ -71,10 +71,4 @@ class MultiplayerNetwork{
|
||||
let encoded = (try? encoder.encode(NotificationModel(name: name)))!
|
||||
sendData(data: encoded)
|
||||
}
|
||||
|
||||
func sendHeartbeatToPlayer() {
|
||||
let encoder = JSONEncoder()
|
||||
let encoded = (try? encoder.encode(Heartbeat(date: Date())))!
|
||||
sendData(data: encoded)
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ class RoundTimer: Timer {
|
||||
|
||||
var timer: Timer?
|
||||
var timeLeft: Int = 0
|
||||
var isHeartbeatLocked = false
|
||||
var calculate = false
|
||||
var roundEnded = "Syncing"
|
||||
|
||||
@ -69,10 +68,5 @@ class RoundTimer: Timer {
|
||||
calculate = false
|
||||
}
|
||||
}
|
||||
|
||||
if (!isHeartbeatLocked && (timeLeft % 7 == 0)){
|
||||
MultiplayerNetwork.sharedInstance.sendHeartbeatToPlayer()
|
||||
isHeartbeatLocked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user