示例#1
0
            public override void FailedWithError(GKTurnBasedMatchmakerViewController viewController, MonoTouch.Foundation.NSError error)
            {
                Logger.W("MatchMakerDelegate.FailedWithError");

                viewController.DismissViewController(true, null);

                if (ErrorCallback != null)
                {
                    ErrorCallback();
                }
            }
示例#2
0
            public override void WasCancelled(GKTurnBasedMatchmakerViewController viewController)
            {
                Logger.I("MatchMakerDelegate.WasCancelled");

                viewController.DismissViewController(true, null);

                if (CancelCallback != null)
                {
                    CancelCallback();
                }
            }
示例#3
0
            public override void FoundMatch(GKTurnBasedMatchmakerViewController viewController, GKTurnBasedMatch match)
            {
                Logger.I("MatchMakerDelegate.FoundMatch");

                viewController.DismissViewController(true, null);

                PuzzleData puzzleData = new PuzzleData();

                puzzleData.Match   = match;
                puzzleData.MatchId = match.MatchID;

                bool matchError = false;

                if (match.MatchData.Length > 0)
                {
                    // Match has data
//					var tp = GameCenterHelper.GetPuzzleFromMatch (match);
                    // TODO ?
                }
                else
                {
                    // No data: new match

                    // Set up outcomes
                    // -> Player who sent the picture set a time first
                    match.Participants [0].MatchOutcome = GKTurnBasedMatchOutcome.First;
                    match.Participants [1].MatchOutcome = GKTurnBasedMatchOutcome.Second;
                }

                if (matchError == false)
                {
                    match.Remove(new GKNotificationHandler((e) => {}));

                    if (MatchFoundCallback != null)
                    {
                        MatchFoundCallback(puzzleData);
                    }
                }
                else
                {
                    if (ErrorCallback != null)
                    {
                        ErrorCallback();
                    }
                }
            }
示例#4
0
            public override void TurnBasedMatchmakerViewControllerDidFailWithError(GKTurnBasedMatchmakerViewController viewController, NSError error)
            {
                // Automatically close the VC.
                if (viewController != null)
                {
                    viewController.DismissViewController(true, null);
                }

                if (ResetMatchmakerVC != null)
                {
                    ResetMatchmakerVC();
                }

                // Invoke consumer callback.
                if (ErrorCallback != null)
                {
                    ErrorCallback(error != null ? error.LocalizedDescription : string.Empty);
                }
            }
示例#5
0
            public override void TurnBasedMatchmakerViewControllerWasCancelled(GKTurnBasedMatchmakerViewController viewController)
            {
                // Automatically close the VC.
                if (viewController != null)
                {
                    viewController.DismissViewController(true, null);
                }

                if (ResetMatchmakerVC != null)
                {
                    ResetMatchmakerVC();
                }

                // Invoke consumer callback.
                if (CancelCallback != null)
                {
                    CancelCallback();
                }
            }
示例#6
0
            public override void WasCancelled(GKTurnBasedMatchmakerViewController viewController)
            {
                Logger.I ("MatchMakerDelegate.WasCancelled");

                viewController.DismissViewController (true, null);

                if (CancelCallback != null)
                    CancelCallback ();
            }
示例#7
0
            public override void FoundMatch(GKTurnBasedMatchmakerViewController viewController, GKTurnBasedMatch match)
            {
                Logger.I ("MatchMakerDelegate.FoundMatch");

                viewController.DismissViewController (true, null);

                PuzzleData puzzleData = new PuzzleData ();
                puzzleData.Match = match;
                puzzleData.MatchId = match.MatchID;

                bool matchError = false;

                if (match.MatchData.Length > 0) {
                    // Match has data
                //					var tp = GameCenterHelper.GetPuzzleFromMatch (match);
                    // TODO ?
                } else {
                    // No data: new match

                    // Set up outcomes
                    // -> Player who sent the picture set a time first
                    match.Participants [0].MatchOutcome = GKTurnBasedMatchOutcome.First;
                    match.Participants [1].MatchOutcome = GKTurnBasedMatchOutcome.Second;
                }

                if (matchError == false) {
                    match.Remove (new GKNotificationHandler ((e) => {}));

                    if (MatchFoundCallback != null) {
                        MatchFoundCallback (puzzleData);
                    }
                } else {
                    if (ErrorCallback != null) {
                        ErrorCallback ();
                    }
                }
            }
示例#8
0
            public override void FailedWithError(GKTurnBasedMatchmakerViewController viewController, MonoTouch.Foundation.NSError error)
            {
                Logger.W ("MatchMakerDelegate.FailedWithError");

                viewController.DismissViewController (true, null);

                if (ErrorCallback != null)
                    ErrorCallback ();
            }
            public override void FoundMatch(GKTurnBasedMatchmakerViewController viewController, GKTurnBasedMatch match)
            {
                Logger.I("Versus match found...");

                viewController.DismissViewController(true, null);

                this.parent.CurrentGKMatch = match;

                bool matchError = false;

                VersusMatch versusMatch = GameCenterHelper.ParseMatch(match);

                if (versusMatch == null)
                {
                  matchError = true;
                }
                else
                {
                  if (MatchFoundCallback != null)
                  {
                MatchFoundCallback(versusMatch);
                  }
                }

                if (matchError)
                {
                  GameCenterHelper.KillMatch(match);
                }
            }