Esempio n. 1
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)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			
			viewController = new MainViewController ();
			window.RootViewController = viewController;
			window.MakeKeyAndVisible ();

			if (!isGameCenterAPIAvailable ())
				gameCenterAuthenticationComplete = false;

			else {

				
				GKLocalPlayer.LocalPlayer.AuthenticateHandler = (ui, error) => 
				{
					if(ui != null)
					{
						viewController.PresentViewController(ui,true,null);
					}
					else if(error != null)
					{
						new UIAlertView ("Error", error.ToString(), null, "OK", null).Show();
					}
					else if(GKLocalPlayer.LocalPlayer.Authenticated)
					{
						this.gameCenterAuthenticationComplete = true;

						//Switching Users
						if(currentPlayerID != null || currentPlayerID != GKLocalPlayer.LocalPlayer.PlayerID)
						{
							currentPlayerID = GKLocalPlayer.LocalPlayer.PlayerID;
							viewController.player = new PlayerModel();
							viewController.player.loadStoredScores();
							viewController.player.loadSotredAchievements();

						}
					}
					else
					{
						this.gameCenterAuthenticationComplete = false;
					}


				};
			}
			
			return true;
		}
Esempio n. 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)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            if (!isGameCenterAPIAvailable())
            {
                new UIAlertView("Error", "Game Center is not supported on this device", null, "OK", null).Show();
                return(true);
            }
            viewController            = new MainViewController();
            window.RootViewController = viewController;
            window.MakeKeyAndVisible();

            GKLocalPlayer.LocalPlayer.Authenticate(viewController.authenticatedHandler);

            return(true);
        }
		//
		// 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)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			if (!isGameCenterAPIAvailable ())
			{
				new UIAlertView ("Error", "Game Center is not supported on this device", null, "OK", null).Show();
				return true;
			}
			viewController = new MainViewController ();
			window.RootViewController = viewController;
			window.MakeKeyAndVisible ();

			GKLocalPlayer.LocalPlayer.Authenticate (viewController.authenticatedHandler);

			return true;
		}