Beispiel #1
0
 void SharePuzzle()
 {
     // Send to a friend
     GameCenterHelper.NewVersusPhoto(ui => {
         InvokeOnMainThread(() => {
             PresentViewController(ui, true, null);
         });
     }, matchPuzzle => {
         // Launch level
         LaunchPuzzleForCurrentImage(matchPuzzle);
     }, null, null, null);
 }
Beispiel #2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Logger.I("Finished launching");

            // Game center
            GameCenterHelper.Authenticate((ui) => {
                InvokeOnMainThread(() => {
                    Window.RootViewController.PresentViewController(ui, true, null);
                });
            }
                                          );

            // Savedgames
            PuzzleService.Instance.Initialize(
                "puzzles/path/",
                "pix.save"
                );

            return(true);
        }
Beispiel #3
0
        public void LoadMatches()
        {
            if (puzzlesWitHFriends != null)
            {
                puzzlesWitHFriends.Clear();
            }

            if (GameCenterHelper.IsAuthenticated)
            {
                GameCenterHelper.GetFriendsPuzzles((puzzles) => {
                    puzzlesWitHFriends = puzzles;

                    CollectionView.ReloadData();
                });
            }
            else
            {
                // TODO Say that it requires GameCenter
                Logger.W("Can't play with friends without Game Center");
            }
        }
Beispiel #4
0
        private void GridCompleted()
        {
            StopTimer();

            // Register the score
            this.Puzzle.AddPlayerScore(GameCenterHelper.LocalPlayer.PlayerID, true, mCurrentTime);
            PuzzleService.Instance.Save();

            // Is it a versus match?
            if (Puzzle.Match != null)
            {
                // If so, send the score to the friend
                GameCenterHelper.UpdateMatchFromPuzzle(Puzzle, (err) => {
                    UIAlertView alert = new UIAlertView(
                        "Versus",
                        "Data sent? " + err,
                        null,
                        "TODO");

                    alert.Dismissed += (object sender, UIButtonEventArgs e) => {
                        GoBackToMenu();
                    };
                    alert.Show();
                });
            }
            else
            {
                UIAlertView alert = new UIAlertView(
                    "Game Over",
                    "You did it! ",
                    null,
                    "OK");

                alert.Dismissed += (object sender, UIButtonEventArgs e) => {
                    GoBackToMenu();
                };
                alert.Show();
            }
        }