Esempio n. 1
0
    void CreateMeeting()
    {
        Log("Creating meeting.");

        // start a match with 2 to 4 players
        RealTimeMatchesController.StartMatch(2, 4);
    }
Esempio n. 2
0
    // when the local player invites others from game center app
    void OnPlayersInvited(object sender, PlayersInvitedEventArgs e)
    {
        Log("Invited users from Game Center app: " + e.playersToInvite);

        // bring up match making interface with the array of invited players
        RealTimeMatchesController.StartMatch(2, 4, 0, 0, e.playersToInvite);
    }
Esempio n. 3
0
 void OnCustomFoundMatch(GKMatch match, NSError error)
 {
     if (error != null)
     {
         Log("Error with matchmaker: " + error.LocalizedDescription());
     }
     else if (match != null)
     {
         // set the high-level match, and it will raise MatchMakerFoundMatch event
         RealTimeMatchesController.SetCurrentMatch(match);
     }
 }
Esempio n. 4
0
        public override void DidRequestMatchWithPlayers(GKPlayer player, object[] playerIDsToInvite)
        {
            // send it to both realtime and turn-based if they are init'd
            if (RealTimeMatchesController._init)
            {
                RealTimeMatchesController._MatchInviteHandler(null, playerIDsToInvite);
            }

            if (TurnBasedMatchesController._init)
            {
                Player.LoadPlayersByIDs(playerIDsToInvite.Cast <string>().ToArray(), delegate(Player[] players) {
                    if (players.Length > 0)
                    {
                        TurnBasedMatchesController._OnInvitePlayers(players);
                    }
                });
            }
        }
Esempio n. 5
0
    void Start()
    {
        // only do it on device
        if (CoreXT.IsDevice)
        {
            // subscribe to events
            GameKitXT.LocalPlayerAuthenticated        += OnLocalPlayerAuthenticated;
            GameKitXT.LocalPlayerAuthenticationFailed += LocalPlayerAuthenticationFailed;

            // init real time multiplayer events and controller
            RealTimeMatchesController.MatchMakerCancelled  += OnMatchMakerCancelled;
            RealTimeMatchesController.MatchMakerFailed     += OnMatchMakerFailed;
            RealTimeMatchesController.MatchMakerFoundMatch += OnMatchMakerFoundMatch;
            RealTimeMatchesController.InviteAccepted       += OnInviteAccepted;
            RealTimeMatchesController.PlayersInvited       += OnPlayersInvited;
            RealTimeMatchesController.Init();

            // finally authenticate player
            GameKitXT.AuthenticateLocalPlayer();
        }
    }
        public override void DidFindMatch(GKMatchmakerViewController viewController, GKMatch match)
        {
            UIApplication.deviceRootViewController.DismissViewController(true, null);

            RealTimeMatchesController.SetCurrentMatch(match);
        }
        public override void WasCancelled(GKMatchmakerViewController viewController)
        {
            UIApplication.deviceRootViewController.DismissViewController(true, null);

            RealTimeMatchesController._OnMatchMakerCancelled();
        }
        public override void DidFail(GKMatchmakerViewController viewController, NSError error)
        {
            UIApplication.deviceRootViewController.DismissViewController(true, null);

            RealTimeMatchesController._OnMatchMakerFailed(error);
        }
Esempio n. 9
0
 public override void DidAccept(GKPlayer player, GKInvite invite)
 {
     RealTimeMatchesController._MatchInviteHandler(invite, null);
 }