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(ModalContentComponent(
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: "",
anchorPoint: anchorPoint
)

View File

@ -22,10 +22,11 @@ class TwoPlayerDefaultTestMap: MapProtocol {
func load() {
// Create Bases
let basePlayerOne = Base(
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
)
@ -48,7 +49,7 @@ class TwoPlayerDefaultTestMap: MapProtocol {
let basePlayerTwo = Base(
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
)

View File

@ -33,7 +33,6 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
var viewController: UIViewController?
var mpMatchStarted: Bool
var isServer: Bool
var spieler1: GKPlayer?
var nameSpieler1 = ""
var menusc: MenuScene?
let localPlayer: GKLocalPlayer = GKLocalPlayer.local
@ -154,13 +153,21 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
if player == GKLocalPlayer.local {
self.isServer = true
self.spieler1 = player
self.nameSpieler1 = self.spieler1!.displayName
} else {
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.menusc!.loadScene(scene: GameScene(size: self.menusc!.size))
})