예제 #1
0
 public override void PlayerWantsToQuitMatch(GKPlayer player, GKTurnBasedMatch match)
 {
     if (MatchDelegate != null)
     {
         MatchDelegate(TurnBasedMatch.FromGKTurnBasedMatch(match), false, true);
     }
 }
예제 #2
0
            public override void PlayerReceivedTurnEventForMatch(GKPlayer player, GKTurnBasedMatch match, bool didBecomeActive)
            {
                if (CloseAndResetMatchmakerVC != null)
                {
                    CloseAndResetMatchmakerVC();
                }

                if (MatchDelegate != null)
                {
                    MatchDelegate(TurnBasedMatch.FromGKTurnBasedMatch(match), didBecomeActive, false);
                }
            }
예제 #3
0
            public override void PlayerMatchEnded(GKPlayer player, GKTurnBasedMatch match)
            {
                if (CloseAndResetMatchmakerVC != null)
                {
                    CloseAndResetMatchmakerVC();
                }

                if (MatchDelegate != null)
                {
                    MatchDelegate(TurnBasedMatch.FromGKTurnBasedMatch(match), false, false);
                }
            }
예제 #4
0
        public void GetAllMatches(Action <TurnBasedMatch[]> callback)
        {
            Util.NullArgumentTest(callback);

            GKTurnBasedMatch.LoadMatches(
                (gkMatches, nsError) =>
            {
                TurnBasedMatch[] matches = gkMatches != null ?
                                           gkMatches.Select(gkm => TurnBasedMatch.FromGKTurnBasedMatch(gkm)).ToArray() : null;

                callback(matches);
            });
        }
예제 #5
0
        public void Rematch(TurnBasedMatch match, Action <bool, TurnBasedMatch> callback)
        {
            Util.NullArgumentTest(match);

            match.GC_TurnBasedMatch.Rematch((gkMatch, error) =>
            {
                if (error != null)
                {
                    Debug.Log("Failed to rematch with error " + error.LocalizedDescription);
                }

                if (callback != null)
                {
                    callback(error == null, TurnBasedMatch.FromGKTurnBasedMatch(gkMatch));
                }
            });
        }
예제 #6
0
        public void CreateQuickMatch(MatchRequest request, Action <bool, TurnBasedMatch> callback)
        {
            Util.NullArgumentTest(request);
            Util.NullArgumentTest(callback);

            using (var gkReq = request.ToGKMatchRequest())
            {
                GKTurnBasedMatch.FindMatchForRequest(gkReq, (gkMatch, nsError) =>
                {
                    TurnBasedMatch match = TurnBasedMatch.FromGKTurnBasedMatch(gkMatch);

                    if (nsError != null)
                    {
                        Debug.Log("Failed to create quick match with error " + nsError.LocalizedDescription);
                    }

                    if (callback != null)
                    {
                        callback(nsError == null, match);
                    }
                });
            }
        }