Compare commits

...

12 Commits

Author SHA1 Message Date
Niko Jochim
ae4dfb1b94 Merge remote-tracking branch 'refs/remotes/origin/devTestBranch' 2020-07-02 17:08:16 +02:00
127-Z3R0
7ecebe83e4 change build-version for final delivery 2020-07-02 17:08:00 +02:00
127-Z3R0
6702f82782 Change max_rounds -> thanks Hr. Jochim 2020-07-02 17:05:34 +02:00
Niko Jochim
9a8e8ef663 Merge remote-tracking branch 'refs/remotes/origin/devTestBranch' 2020-07-02 17:04:21 +02:00
127-Z3R0
2a17e81a3a Change version for final delivery 2020-07-02 16:11:27 +02:00
Niko Jochim
2f056725d6 FIX BUGS 2020-07-02 13:55:26 +02:00
Aldin Duraki
43ba0be225 Merge remote-tracking branch 'refs/remotes/origin/devTestBranch' 2020-07-02 13:01:37 +02:00
Aldin Duraki
cbb65769a3 Fix connection timeout 2020-07-02 13:01:21 +02:00
Niko Jochim
66aa21ccb4 Merge remote-tracking branch 'refs/remotes/origin/devTestBranch' 2020-07-02 12:54:22 +02:00
Niko Jochim
985e4f48cb FIX trigger GameQuit 2020-07-02 12:53:45 +02:00
Aldin Duraki
f4cd97cac7 Test crash bugfix 2020-07-02 12:48:51 +02:00
Niko Jochim
5d8df46361 change trigger GameEnd 2020-07-02 12:34:29 +02:00
9 changed files with 49 additions and 48 deletions

View File

@ -611,14 +611,15 @@
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements; CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = DDKFQG46BQ; DEVELOPMENT_TEAM = DDKFQG46BQ;
INFOPLIST_FILE = GoldWars/Info.plist; INFOPLIST_FILE = GoldWars/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.5;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 2.0;
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars; PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -634,14 +635,15 @@
CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements; CODE_SIGN_ENTITLEMENTS = GoldWars/GoldWars.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = DDKFQG46BQ; DEVELOPMENT_TEAM = DDKFQG46BQ;
INFOPLIST_FILE = GoldWars/Info.plist; INFOPLIST_FILE = GoldWars/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.5;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 2.0;
PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars; PRODUCT_BUNDLE_IDENTIFIER = de.hft.stuttgart.ip2.goldwars;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -48,7 +48,8 @@ class EloHelper {
let scoreForPeer = winner == GameCenterManager.sharedInstance.localPlayer ? looser_new : winner_new let scoreForPeer = winner == GameCenterManager.sharedInstance.localPlayer ? looser_new : winner_new
let scoreForHost = winner == GameCenterManager.sharedInstance.localPlayer ? winner_new : looser_new let scoreForHost = winner == GameCenterManager.sharedInstance.localPlayer ? winner_new : looser_new
print("PEER",scoreForPeer )
print("Host",scoreForHost )
MultiplayerNetwork.sharedInstance.sendEloData(scoreToReport: scoreForPeer) MultiplayerNetwork.sharedInstance.sendEloData(scoreToReport: scoreForPeer)
reportScore(score: scoreForHost.value) reportScore(score: scoreForHost.value)
} }

View File

@ -61,7 +61,11 @@ class HUD: GKEntity {
y: EntityManager.gameEMInstance.scene.size.height * 0.1), y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: { } onButtonPress: { }
) )
leaveGame = ButtonNode(textureName: "exitButton", text: "" , isEnabled: true, position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.05, y: EntityManager.gameEMInstance.scene.size.height * 0.11), onButtonPress: { leaveGame = ButtonNode(textureName: "exitButton",
text: "" ,
isEnabled: true,
position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.05, y: EntityManager.gameEMInstance.scene.size.height * 0.11),
onButtonPress: {
EntityManager.gameEMInstance.add(Modal(modaltype: .QuitGame, base: nil, anchorPoint: CGPoint(x: EntityManager.gameEMInstance.scene.size.width / 2 , y: EntityManager.gameEMInstance.scene.size.height / 2), gameScene: EntityManager.gameEMInstance.scene, currentDraggedBase: nil, touchLocation: nil, collisionBase: nil)) EntityManager.gameEMInstance.add(Modal(modaltype: .QuitGame, base: nil, anchorPoint: CGPoint(x: EntityManager.gameEMInstance.scene.size.width / 2 , y: EntityManager.gameEMInstance.scene.size.height / 2), gameScene: EntityManager.gameEMInstance.scene, currentDraggedBase: nil, touchLocation: nil, collisionBase: nil))
}) })
leaveGame.size = CGSize(width: 120, height: 120); leaveGame.size = CGSize(width: 120, height: 120);

View File

@ -105,6 +105,7 @@ class Modal: GKEntity{
GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 6)) GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 6))
GameCenterManager.sharedInstance.opponentQuit = false GameCenterManager.sharedInstance.opponentQuit = false
GameCenterManager.sharedInstance.quitGame = true GameCenterManager.sharedInstance.quitGame = true
(EntityManager.gameEMInstance.scene as! GameScene).gameQuit()
})) }))
case .PauseGame: case .PauseGame:
break break

View File

@ -170,14 +170,17 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
os_log("State 4 erhalten, Peer hat verloren", log: LOG, type: .info) os_log("State 4 erhalten, Peer hat verloren", log: LOG, type: .info)
winner = hostingPlayer?.displayName winner = hostingPlayer?.displayName
gameEnded = true gameEnded = true
(EntityManager.gameEMInstance.scene as! GameScene).gameEnd()
case 5: case 5:
os_log("State 5 erhalten, Peer hat gewonnen", log: LOG, type: .info) os_log("State 5 erhalten, Peer hat gewonnen", log: LOG, type: .info)
winner = peerPlayer?.displayName winner = peerPlayer?.displayName
gameEnded = true gameEnded = true
(EntityManager.gameEMInstance.scene as! GameScene).gameEnd()
case 6: case 6:
os_log("State 6 erhalten, Peer hat Spiel verlassen ", log: LOG, type: .info) os_log("State 6 erhalten, Peer hat Spiel verlassen ", log: LOG, type: .info)
opponentQuit = true opponentQuit = true
quitGame = true quitGame = true
(EntityManager.gameEMInstance.scene as! GameScene).gameQuit()
default: default:
break break
} }

View File

@ -22,8 +22,8 @@ class GameViewController: UIViewController {
scene.scaleMode = .aspectFill scene.scaleMode = .aspectFill
view.presentScene(scene) view.presentScene(scene)
//TODO: create dev profile or remove on delivery //TODO: create dev profile or remove on delivery
view.showsFPS = true // view.showsFPS = true
view.showsNodeCount = true // view.showsNodeCount = true
} }
GameCenterManager.sharedInstance.viewController = self GameCenterManager.sharedInstance.viewController = self
} }

View File

@ -160,7 +160,7 @@ class RoundCalculatorService {
winner == GameCenterManager.sharedInstance.hostingPlayer?.displayName ? GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 4)) : GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 5)) winner == GameCenterManager.sharedInstance.hostingPlayer?.displayName ? GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 4)) : GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 5))
GameCenterManager.sharedInstance.winner = winner GameCenterManager.sharedInstance.winner = winner
GameCenterManager.sharedInstance.gameEnded = true GameCenterManager.sharedInstance.gameEnded = true
(EntityManager.gameEMInstance.scene as! GameScene).gameEnd()
// Update EloSystem // Update EloSystem
if winner == GameCenterManager.sharedInstance.hostingPlayer?.displayName { if winner == GameCenterManager.sharedInstance.hostingPlayer?.displayName {
EloHelper.updateEloScore(winner: GameCenterManager.sharedInstance.hostingPlayer!, hatDenNikoGemacht: GameCenterManager.sharedInstance.peerPlayer!) EloHelper.updateEloScore(winner: GameCenterManager.sharedInstance.hostingPlayer!, hatDenNikoGemacht: GameCenterManager.sharedInstance.peerPlayer!)

View File

@ -13,6 +13,7 @@ class RoundTimer: Timer {
var timer: Timer? var timer: Timer?
var timeLeft: Int = 0 var timeLeft: Int = 0
var isHeartbeatLocked = false var isHeartbeatLocked = false
var isTimerStopped = false
var calculate = false var calculate = false
var roundEnded = "Syncing" var roundEnded = "Syncing"
@ -31,48 +32,42 @@ class RoundTimer: Timer {
} }
func stopTimer() { func stopTimer() {
guard timer != nil else { return } isTimerStopped = true
timer?.invalidate()
timer = nil
} }
func resumeTimer() { func resumeTimer() {
timer = Timer.scheduledTimer( isTimerStopped = false
timeInterval: 1.0,
target: self,
selector: #selector(onTimerFires),
userInfo: nil,
repeats: true
)
} }
@objc func onTimerFires() @objc func onTimerFires()
{ {
timeLeft -= 1 if !isTimerStopped {
EntityManager.gameEMInstance.updateTime(time: (timeLeft > 0 ? String(timeLeft) : roundEnded)) timeLeft -= 1
EntityManager.gameEMInstance.updateTime(time: (timeLeft > 0 ? String(timeLeft) : roundEnded))
if timeLeft == 0 { if timeLeft == 0 {
EntityManager.gameEMInstance.removeModal() EntityManager.gameEMInstance.removeModal()
RoundCalculatorService.sharedInstance.resetNumberOfAttacksAndFormats() RoundCalculatorService.sharedInstance.resetNumberOfAttacksAndFormats()
if !MultiplayerNetwork.sharedInstance.isSending { if !MultiplayerNetwork.sharedInstance.isSending {
MultiplayerNetwork.sharedInstance.sendPlayerMoves(localRoundData: DataService.sharedInstance.localRoundData) MultiplayerNetwork.sharedInstance.sendPlayerMoves(localRoundData: DataService.sharedInstance.localRoundData)
}
calculate = true
} }
calculate = true
}
if timeLeft <= 0 { if timeLeft <= 0 {
if calculate if calculate
&& !RoundCalculatorService.sharedInstance.isCalculating && !RoundCalculatorService.sharedInstance.isCalculating
&& DataService.sharedInstance.didReceiveAllData() && DataService.sharedInstance.didReceiveAllData()
&& GameCenterManager.sharedInstance.isServer { && GameCenterManager.sharedInstance.isServer {
RoundCalculatorService.sharedInstance.calculateRound() RoundCalculatorService.sharedInstance.calculateRound()
calculate = false calculate = false
}
} }
}
if (!isHeartbeatLocked && (timeLeft % 7 == 0)){ if (!isHeartbeatLocked && (timeLeft % 7 == 0)){
MultiplayerNetwork.sharedInstance.sendHeartbeatToPlayer() MultiplayerNetwork.sharedInstance.sendHeartbeatToPlayer()
isHeartbeatLocked = true; isHeartbeatLocked = true;
}
} }
} }
} }

View File

@ -78,12 +78,7 @@ class GameScene: SKScene{
override func update(_ currentTime: TimeInterval) { override func update(_ currentTime: TimeInterval) {
entityManager.getBackground()?.update(deltaTime: currentTime) entityManager.getBackground()?.update(deltaTime: currentTime)
if GameCenterManager.sharedInstance.gameEnded && !gameEndEffects {
gameEnd()
}
if GameCenterManager.sharedInstance.quitGame {
gameQuit()
}
} }