This commit is contained in:
Jakob Haag 2020-05-11 19:18:19 +02:00
parent 282a729250
commit 41d5fc8a5c
3 changed files with 15 additions and 7 deletions

View File

@ -20,7 +20,7 @@ class Modal: GKEntity{
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint)) addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
addComponent(ModalContentComponent( addComponent(ModalContentComponent(
header: "Basis Information", header: "Basis Information",
body: "Diese Basis enthält \(base.unitCount) Einheiten", body: "Diese Basis enthält \(base.unitCount) Einheiten und gehört Spieler \(base.ownerShipPlayer?.displayName ?? "null")",
footer: "", footer: "",
anchorPoint: anchorPoint anchorPoint: anchorPoint
) )

View File

@ -22,10 +22,11 @@ class TwoPlayerDefaultTestMap: MapProtocol {
func load() { func load() {
// Create Bases // Create Bases
let basePlayerOne = Base( let basePlayerOne = Base(
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2), position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2),
player: MatchmakingHelper.sharedInstance.mpMatch?.players[0], player: (MatchmakingHelper.sharedInstance.isServer) ? GKLocalPlayer.local : MatchmakingHelper.sharedInstance.mpMatch?.players[0],
team: .team1 team: .team1
) )
@ -48,7 +49,7 @@ class TwoPlayerDefaultTestMap: MapProtocol {
let basePlayerTwo = Base( let basePlayerTwo = Base(
position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2), position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2),
player: MatchmakingHelper.sharedInstance.mpMatch?.players[1], player: (!MatchmakingHelper.sharedInstance.isServer) ? GKLocalPlayer.local : MatchmakingHelper.sharedInstance.mpMatch?.players[0],
team: .team2 team: .team2
) )

View File

@ -33,7 +33,6 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
var viewController: UIViewController? var viewController: UIViewController?
var mpMatchStarted: Bool var mpMatchStarted: Bool
var isServer: Bool var isServer: Bool
var spieler1: GKPlayer?
var nameSpieler1 = "" var nameSpieler1 = ""
var menusc: MenuScene? var menusc: MenuScene?
let localPlayer: GKLocalPlayer = GKLocalPlayer.local let localPlayer: GKLocalPlayer = GKLocalPlayer.local
@ -154,13 +153,21 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
if player == GKLocalPlayer.local { if player == GKLocalPlayer.local {
self.isServer = true self.isServer = true
self.spieler1 = player
self.nameSpieler1 = self.spieler1!.displayName
} else { } else {
self.isServer = false self.isServer = false
} }
print("====================================")
print(GKLocalPlayer.local)
for player in MatchmakingHelper.sharedInstance.mpMatch!.players {
print(player)
}
print("====================================")
print(MatchmakingHelper.sharedInstance.mpMatch)
print("====================================")
self.delegate?.matchStarted() self.delegate?.matchStarted()
self.menusc!.loadScene(scene: GameScene(size: self.menusc!.size)) self.menusc!.loadScene(scene: GameScene(size: self.menusc!.size))
}) })