public static void OnInvititationReceived(GKInvite invite, string[] players) { Logger.I("Invitaion received: " + invite); GKMatchmaker.SharedMatchmaker.Match(invite, (match, error) => { if (error == null) { Logger.I("Invitation transformed in match."); } else { Logger.E("Invitation failed.", error); } }); }
internal static Invitation FromGKInvite(GKInvite gkInvite, MatchType type) { if (gkInvite == null) { return(null); } return(new Invitation( type, Participant.FromGKPlayer(gkInvite.Sender, Participant.ParticipantStatus.Joined, true), // the inviter should be connected to room already gkInvite.PlayerGroup) { GK_Invite = gkInvite }); }
public override void PlayerDidAcceptInvite(GKPlayer player, GKInvite invite) { // On iOS (Game Center), users receive an invitation as a message in the iMessage app. // This only runs if the user clicks the message, thus 'shouldAutoAccept' is always true. // Also the invitation delegate is actually called for Real-Time matches only. // For Turn-Based matches, the MatchDelegate is called instead because a user can join // multiple Turn-Based matches. RuntimeHelper.RunOnMainThread(() => { if (sInvitationDelegate != null) { sInvitationDelegate(Invitation.FromGKInvite(invite, MatchType.RealTime), true); } }); }
internal static void _MatchInviteHandler(GKInvite acceptedInvite, object[] playersToInvite) { if (acceptedInvite != null) { // show new view controller var mmvc = new GKMatchmakerViewController(acceptedInvite); mmvc.matchmakerDelegate = MatchmakerViewControllerDelegate.instance; UIApplication.deviceRootViewController.PresentViewController(mmvc, true, null); // load players and dispatch event Player.LoadPlayersByIDs(new string[] { acceptedInvite.inviter }, delegate(Player[] players) { if (players.Length > 0) { if (_inviteAcceptedHandlers != null) { _inviteAcceptedHandlers(null, new InviteAcceptedEventArgs(players[0], acceptedInvite.playerGroup, acceptedInvite.playerAttributes)); } } acceptedInvite = null; }); mmvc = null; } else if (playersToInvite != null) { // load players and dispatch event Player.LoadPlayersByIDs(playersToInvite.Cast <string>().ToArray(), delegate(Player[] players) { if (players.Length > 0) { if (_playersInvitedHandlers != null) { _playersInvitedHandlers(null, new PlayersInvitedEventArgs(players)); } } }); } }
public static void OnInvititationReceived(GKInvite invite, string[] players) { Logger.I ("Invitaion received: " + invite); GKMatchmaker.SharedMatchmaker.Match (invite, (match, error) => { if (error == null) { Logger.I("Invitation transformed in match."); } else { Logger.E("Invitation failed.", error); } }); }
internal static void _MatchInviteHandler(GKInvite acceptedInvite, object[] playersToInvite) { if (acceptedInvite != null) { // show new view controller var mmvc = new GKMatchmakerViewController(acceptedInvite); mmvc.matchmakerDelegate = MatchmakerViewControllerDelegate.instance; UIApplication.deviceRootViewController.PresentViewController(mmvc, true, null); // load players and dispatch event Player.LoadPlayersByIDs(new string[] {acceptedInvite.inviter}, delegate(Player[] players) { if (players.Length > 0) { if (_inviteAcceptedHandlers != null) _inviteAcceptedHandlers(null, new InviteAcceptedEventArgs(players[0], acceptedInvite.playerGroup, acceptedInvite.playerAttributes)); } acceptedInvite = null; }); mmvc = null; } else if (playersToInvite != null) { // load players and dispatch event Player.LoadPlayersByIDs(playersToInvite.Cast<string>().ToArray(), delegate(Player[] players) { if (players.Length > 0) { if (_playersInvitedHandlers != null) _playersInvitedHandlers(null, new PlayersInvitedEventArgs(players)); } }); } }
public override void DidAccept(GKPlayer player, GKInvite invite) { RealTimeMatchesController._MatchInviteHandler(invite, null); }
public override void DidAccept(GKPlayer player, GKInvite invite) { RealTimeMatchesController._MatchInviteHandler(invite, null); }
public virtual void PlayerDidAcceptInvite(GKPlayer player, GKInvite invite) { }