Example #1
0
        /// <summary>
        /// Send a photo to a friend via GameCenter
        /// </summary>
        /// <param name="matchFoundCallback">Match found callback.</param>
        /// <param name="cancelCallback">Cancel callback.</param>
        /// <param name="errorCallback">Error callback.</param>
        /// <param name="playerQuitCallback">Player quit callback.</param>
        public static void NewVersusPhoto(Action <UIViewController> showCallback, Action <PuzzleData> matchFoundCallback, Action cancelCallback, Action errorCallback, Action playerQuitCallback)
        {
            Logger.I("Game center: new turn based match request...");

            GKMatchRequest matchRequest = new GKMatchRequest();

            matchRequest.MinPlayers             = 2;
            matchRequest.MaxPlayers             = 2;
            matchRequest.DefaultNumberOfPlayers = 2;

            GKTurnBasedMatchmakerViewController matchMakerVc = new GKTurnBasedMatchmakerViewController(matchRequest);
            var d = new MatchMakerDelegate();

            d.MatchFoundCallback += matchFoundCallback;
            d.CancelCallback     += cancelCallback;
            d.ErrorCallback      += errorCallback;
            d.PlayerQuitCallback += playerQuitCallback;

            matchMakerVc.Delegate = d;

            if (showCallback != null)
            {
                showCallback(matchMakerVc);
            }
        }
Example #2
0
        /// <summary>
        /// Send a photo to a friend via GameCenter
        /// </summary>
        /// <param name="matchFoundCallback">Match found callback.</param>
        /// <param name="cancelCallback">Cancel callback.</param>
        /// <param name="errorCallback">Error callback.</param>
        /// <param name="playerQuitCallback">Player quit callback.</param>
        public static void NewVersusPhoto(Action<UIViewController> showCallback, Action<PuzzleData> matchFoundCallback, Action cancelCallback, Action errorCallback, Action playerQuitCallback)
        {
            Logger.I ("Game center: new turn based match request...");

            GKMatchRequest matchRequest = new GKMatchRequest ();
            matchRequest.MinPlayers = 2;
            matchRequest.MaxPlayers = 2;
            matchRequest.DefaultNumberOfPlayers = 2;

            GKTurnBasedMatchmakerViewController matchMakerVc = new GKTurnBasedMatchmakerViewController (matchRequest);
            var d = new MatchMakerDelegate ();
            d.MatchFoundCallback += matchFoundCallback;
            d.CancelCallback += cancelCallback;
            d.ErrorCallback += errorCallback;
            d.PlayerQuitCallback += playerQuitCallback;

            matchMakerVc.Delegate = d;

            if (showCallback != null) {
                showCallback (matchMakerVc);
            }
        }
        public override void NewMatch(Action<VersusMatch> matchFoundCallback, Action cancelCallback, Action errorCallback, Action playerQuitCallback)
        {
            GKMatchRequest matchRequest = new GKMatchRequest();
              matchRequest.MinPlayers = 2;
              matchRequest.MaxPlayers = 2;
              matchRequest.DefaultNumberOfPlayers = 2;

              GKTurnBasedMatchmakerViewController matchMakerVc = new GKTurnBasedMatchmakerViewController(matchRequest);

              var mmDelegate = new MatchMakerDelegate(this);
              mmDelegate.MatchFoundCallback += matchFoundCallback;
              mmDelegate.CancelCallback += cancelCallback;
              mmDelegate.ErrorCallback += errorCallback;
              mmDelegate.PlayerQuitCallback += playerQuitCallback;
              matchMakerVc.Delegate = mmDelegate;

              ShowGameCenter(matchMakerVc);
        }