-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from ahmedrezik/fix-issue-75
Fix issue #75
- Loading branch information
Showing
13 changed files
with
177 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
GameCenterManager.xcodeproj/project.xcworkspace/xcuserdata | ||
GameCenterManager.xcodeproj/xcuserdata | ||
|
||
*.xcuserstate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// | ||
// Use this file to import your target's public headers that you would like to expose to Swift. | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// | ||
// Use this file to import your target's public headers that you would like to expose to Swift. | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// | ||
// Multiplayer.swift | ||
// GameCenterManager | ||
// | ||
// Created by Sam Spencer on 12/13/15. | ||
// Copyright © 2015 NABZ Software. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import GameKit | ||
|
||
protocol MultiplerManagerDelegate { | ||
func matchStarted(manager:Multiplayer, match:GKMatch) | ||
func matchEnded(manager:Multiplayer, match:GKMatch) | ||
func matchRecievedData(manager:Multiplayer, match:GKMatch, data:NSData, sendingPlayerID:NSString) | ||
} | ||
|
||
protocol MultiplayerPlayerManagerDelegate { | ||
func allPlayersConnectedToMatch(manager:Multiplayer, match:GKMatch, players:[String]) | ||
func allPlayersDisconnectedFromMatch(manager:Multiplayer, match:GKMatch, players:[String]) | ||
func recievedMatchInvitation(manager:Multiplayer, invitedPlayer:GKPlayer, players:[GKPlayer]) | ||
func acceptedMatchInvitation(manager:Multiplayer, invite:GKInvite, player:GKPlayer) | ||
} | ||
|
||
class Multiplayer: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDelegate, GKLocalPlayerListener { | ||
|
||
var matchPresentingController: UIViewController? | ||
var multiplayerMatchStarted: Bool | ||
var multiplayerMatch: GKMatch? | ||
|
||
override init() { | ||
// Initialize the class | ||
matchPresentingController = nil | ||
multiplayerMatchStarted = false | ||
multiplayerMatch = nil | ||
|
||
super.init() | ||
} | ||
|
||
deinit { | ||
GKLocalPlayer.localPlayer().unregisterAllListeners() | ||
} | ||
|
||
class MultiplayerManager { | ||
static let sharedInstance = Multiplayer() | ||
} | ||
|
||
func beginListeningForMatches() { | ||
GKLocalPlayer.localPlayer().registerListener(self) | ||
} | ||
|
||
func matchmakerViewControllerWasCancelled(viewController: GKMatchmakerViewController) { | ||
// Matchmaking was cancelled by the user | ||
matchPresentingController!.dismissViewControllerAnimated(true) { () -> Void in | ||
NSLog("Matchmaking View Controller was dissmissed.") | ||
} | ||
} | ||
|
||
func matchmakerViewController(viewController: GKMatchmakerViewController, didFailWithError error: NSError) { | ||
// Matchmaking failed due to an error | ||
matchPresentingController!.dismissViewControllerAnimated(true) { () -> Void in | ||
NSLog("Error finding match: %@", error) | ||
} | ||
} | ||
|
||
func matchmakerViewController(viewController: GKMatchmakerViewController, didFindMatch match: GKMatch) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Referee.swift | ||
// GameCenterManager | ||
// | ||
// Created by Sam Spencer on 12/13/15. | ||
// Copyright © 2015 NABZ Software. All rights reserved. | ||
// | ||
|
||
|
||
import Foundation | ||
import GameKit | ||
|
||
class Referee: NSObject { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
GameCenterManager.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,74 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"size" : "29x29", | ||
"idiom" : "iphone", | ||
"filename" : "AppIcon29x29.png", | ||
"scale" : "1x" | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"size" : "29x29", | ||
"idiom" : "iphone", | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
"scale" : "3x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"filename" : "AppIcon29x29.png", | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "3x" | ||
"scale" : "1x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"size" : "40x40", | ||
"filename" : "[email protected]", | ||
"idiom" : "iphone", | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "3x" | ||
"scale" : "3x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"size" : "57x57", | ||
"filename" : "[email protected]", | ||
"idiom" : "iphone", | ||
"filename" : "Icon.png", | ||
"scale" : "1x" | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"size" : "57x57", | ||
"idiom" : "iphone", | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
"scale" : "3x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"filename" : "Icon.png", | ||
"idiom" : "iphone", | ||
"scale" : "1x", | ||
"size" : "57x57" | ||
}, | ||
{ | ||
"size" : "60x60", | ||
"filename" : "[email protected]", | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "57x57" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "3x" | ||
"scale" : "3x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "ios-marketing", | ||
"scale" : "1x", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters