public override void DidFinish(GKLeaderboardViewController viewController) { var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var navController = appDelegate.NavController; navController.DismissModalViewControllerAnimated(true); }
public static void ShowLeaderboard() { if ((Gamer.SignedInGamers.Count > 0) && (Gamer.SignedInGamers[0].IsSignedInToLive)) { // Lazy load it if (leaderboardController == null) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); isVisible = false; }; if (Window != null) { if (viewController == null) { viewController = new UIViewController(); Window.Add(viewController.View); viewController.View.Hidden = true; } viewController.PresentModalViewController(leaderboardController, true); isVisible = true; } } } }
public void DefaultCtor() { TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false); using (var vc = new GKLeaderboardViewController()) { Assert.Null(vc.Category, "Category"); Assert.Null(vc.Delegate, "Delegate"); // default Scope vary by iOS version and can't be changed on iOS7 - not worth testing } }
void showLeaderboard() { GKLeaderboardViewController leaderboardViewController = new GKLeaderboardViewController(); leaderboardViewController.Category = "Leaderboard"; leaderboardViewController.DidFinish += (object sender, EventArgs e) => { leaderboardViewController.DismissViewController(true, null); }; this.PresentViewController(leaderboardViewController, true, null); }
/// <summary> /// Shows the leaderboards. /// </summary> public async Task <bool> ShowAllLeaderboards() { var leaderboardViewController = new GKLeaderboardViewController(); leaderboardViewController.Category = "Leaderboard"; leaderboardViewController.DidFinish += (sender, e) => { leaderboardViewController.DismissViewController(true, null); }; await this.view.PresentViewControllerAsync(leaderboardViewController, true); return(true); }
public void OpenLeaderboards() { UIViewController controller = AppMain.Current.Services.GetService(typeof(UIViewController)) as UIViewController; GKLeaderboardViewController leaderboardViewController = new GKLeaderboardViewController(); leaderboardViewController.DidFinish += (object sender, EventArgs e) => { leaderboardViewController.DismissViewController(true, null); }; controller.PresentViewController(leaderboardViewController, true, null); }
public HelloWorldLayer() { // create and initialize a Label var label = new CCLabelTTF("Hello mtouch", "Marker Felt", 64); // ask director for the window size var size = CCDirector.SharedDirector.WinSize; // position the label on the center of the screen label.Position = new PointF(size.Width / 2, size.Height / 2); // add the label as a child to this Layer Add(label); // // Leaderboards and Achievements // // Default font size will be 28 points. CCMenuItemFont.DefaultFontSize = 28; // Achievement Menu Item var itemAchievement = new CCMenuItemFont("Achievements", (sender) => { var achievementController = new GKAchievementViewController() { Delegate = new AchievementDelegate() }; var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var navController = appDelegate.NavController; navController.PresentModalViewController(achievementController, true); }); // Leaderboard Menu Item var itemLeaderBoard = new CCMenuItemFont("Leaderboard", (sender) => { var leaderboardController = new GKLeaderboardViewController() { Delegate = new LeaderboardDelegate() }; var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var navController = appDelegate.NavController; navController.PresentModalViewController(leaderboardController, true); }); var menu = new CCMenu(new CCMenuItem [] { itemAchievement, itemLeaderBoard }); menu.AlignItemsHorizontally(20); menu.Position = new PointF(size.Width / 2, size.Height / 2 - 50); // Add the menu to the layer Add(menu); }
public void DefaultCtor() { #if MONOMAC // fails when executed under BigSur - this has been deprecated for a while (even if it remains working elsewhere) if (TestRuntime.CheckSystemVersion(ApplePlatform.MacOSX, 11, 0)) { Assert.Inconclusive("'LeaderboardViewControllerTest' the native 'init' method returned nil."); } TestRuntime.AssertSystemVersion(ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false); #endif using (var vc = new GKLeaderboardViewController()) { Assert.Null(vc.Category, "Category"); Assert.Null(vc.Delegate, "Delegate"); // default Scope vary by iOS version and can't be changed on iOS7 - not worth testing } }
public void DefaultCtor() { // because of the inheritance changes in GameKit running this on iOS 5.1 and the new registrar gives an: // MonoTouch.MonoTouchException> (Wrapper type 'MonoTouch.GameKit.GKGameCenterViewController' is missing its native ObjectiveC class 'GKGameCenterViewController'.) // ref: https://trello.com/c/OOlimcfJ/230-changing-objc-base-class-can-be-a-breaking-change if (!TestRuntime.CheckSystemAndSDKVersion(6, 0)) { Assert.Ignore("Can't run before iOS 6 with the new registrar enabled"); } using (var vc = new GKLeaderboardViewController()) { Assert.Null(vc.Category, "Category"); Assert.Null(vc.Delegate, "Delegate"); // default Scope vary by iOS version and can't be changed on iOS7 - not worth testing } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { // Lazy load it if (leaderboardController == null) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); }; dvc.PresentModalViewController(leaderboardController, true); } }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { // Lazy load it if ( leaderboardController == null ) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); }; dvc.PresentModalViewController(leaderboardController, true); } }
public void DefaultCtor() { #if MONOMAC // For some reason the init method is not allowed on Xcode 12.2 Beta 3 anymore // but was allowed before that said this class got deprecated in 10.10 so it may now be // a permanent change. if (TestRuntime.CheckExactXcodeVersion(12, 2, beta: 3)) { Assert.Inconclusive("'LeaderboardViewControllerTest' the native 'init' method returned nil."); } #endif TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false); using (var vc = new GKLeaderboardViewController()) { Assert.Null(vc.Category, "Category"); Assert.Null(vc.Delegate, "Delegate"); // default Scope vary by iOS version and can't be changed on iOS7 - not worth testing } }
public static void ShowLeaderboard() { AssertInitialised(); if ((Gamer.SignedInGamers.Count > 0) && (Gamer.SignedInGamers[0].IsSignedInToLive)) { // Lazy load it if (leaderboardController == null) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); IsVisible = false; TouchPanel.EnabledGestures = prevGestures; }; if (_window != null) { if (viewController == null) { viewController = new GuideViewController(_gameViewController); _window.Add(viewController.View); viewController.View.Hidden = true; } prevGestures = TouchPanel.EnabledGestures; TouchPanel.EnabledGestures = GestureType.None; viewController.PresentModalViewController(leaderboardController, true); IsVisible = true; } } } else { UIAlertView alert = new UIAlertView("Error", "You need to be logged into Game Center to view the Leaderboard.", null, "Ok"); alert.Show(); ShowSignIn(1, true); } }
public HelloWorldLayer() { // create and initialize a Label var label = new CCLabelTTF ("Hello mtouch", "Marker Felt", 64); // ask director for the window size var size = CCDirector.SharedDirector.WinSize; // position the label on the center of the screen label.Position = new PointF(size.Width/2, size.Height/2); // add the label as a child to this Layer Add(label); // // Leaderboards and Achievements // // Default font size will be 28 points. CCMenuItemFont.DefaultFontSize = 28; // Achievement Menu Item var itemAchievement = new CCMenuItemFont("Achievements", (sender)=>{ var achievementController = new GKAchievementViewController() {Delegate = new AchievementDelegate()}; var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var navController = appDelegate.NavController; navController.PresentModalViewController(achievementController, true); }); // Leaderboard Menu Item var itemLeaderBoard = new CCMenuItemFont ("Leaderboard", (sender) => { var leaderboardController = new GKLeaderboardViewController() {Delegate = new LeaderboardDelegate()}; var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var navController = appDelegate.NavController; navController.PresentModalViewController(leaderboardController, true); }); var menu = new CCMenu (new CCMenuItem [] {itemAchievement, itemLeaderBoard}); menu.AlignItemsHorizontally(20); menu.Position = new PointF (size.Width/2, size.Height/2 - 50); // Add the menu to the layer Add (menu); }
/// <summary> /// Displays the Game Center Leaderboard interface. /// </summary> /// <param name="leaderboardID">The ID of the leaderboard to be displayed.</param> public static void ShowLeaderboard(string leaderboardID) { if (GKGameCenterViewController.ClassExists) { // ios 6 preferred method var gcvc = new GKGameCenterViewController(); gcvc.gameCenterDelegate = GameCenterControllerDelegate.instance; gcvc.viewState = GKGameCenterViewControllerState.Leaderboards; gcvc.leaderboardTimeScope = GKLeaderboardTimeScope.Today; gcvc.leaderboardCategory = leaderboardID; UIApplication.deviceRootViewController.PresentViewController(gcvc, true, null); } else { var lbvc = new GKLeaderboardViewController(); lbvc.leaderboardDelegate = LeaderboardViewControllerDelegate.instance; lbvc.timeScope = GKLeaderboardTimeScope.Today; lbvc.category = leaderboardID; UIApplication.deviceRootViewController.PresentViewController(lbvc, true, null); } }
public static void ShowLeaderboard() { AssertInitialised(); if ((Gamer.SignedInGamers.Count > 0) && (Gamer.SignedInGamers[0].IsSignedInToLive)) { if (osVersion < 6.0d) { // GKLeaderboardViewController for iOS 5 and older var leaderboardController = new GKLeaderboardViewController(); leaderboardController.DidFinish += delegate(object sender, EventArgs e) { HideViewController(leaderboardController); }; ShowViewController(leaderboardController); } else { // GKGameCenterViewController for iOS 6+ var gameCenterController = new GKGameCenterViewController(); gameCenterController.Finished += delegate(object sender, EventArgs e) { HideViewController(gameCenterController); }; gameCenterController.ViewState = GKGameCenterViewControllerState.Leaderboards; ShowViewController(gameCenterController); } } else { UIAlertView alert = new UIAlertView("Error", "You must be signed in to Game Center to view leaderboards.", null, "OK"); alert.Show(); ShowSignIn(1, true); } }
public override void DidFinish(GKLeaderboardViewController viewController) { viewController.presentingViewController.DismissViewController(true, null); }
public override void DidFinish(GKLeaderboardViewController viewController) { viewController.presentingViewController.DismissViewController(true, null); }
public static void ShowLeaderboard() { if ( ( Gamer.SignedInGamers.Count > 0 ) && ( Gamer.SignedInGamers[0].IsSignedInToLive ) ) { // Lazy load it if ( leaderboardController == null ) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); isVisible = false; }; if (Window !=null) { if(viewController == null) { viewController = new GameVc(); Window.Add(viewController.View); viewController.View.Hidden = true; } viewController.PresentModalViewController(leaderboardController, true); isVisible = true; } } } else { UIAlertView alert = new UIAlertView("Error","You need to be logged into game center to view the High scores.",null,"Ok"); alert.Show(); ShowSignIn(1,true); } }
void showLeaderboard() { GKLeaderboardViewController leaderboardViewController = new GKLeaderboardViewController (); leaderboardViewController.Category = "Leaderboard"; leaderboardViewController.DidFinish += (object sender, EventArgs e) => { leaderboardViewController.DismissViewController(true, null); }; this.PresentViewController (leaderboardViewController, true, null); }
/// <summary> /// Displays the Game Center Leaderboard interface. /// </summary> /// <param name="leaderboardID">The ID of the leaderboard to be displayed.</param> public static void ShowLeaderboard(string leaderboardID) { if (GKGameCenterViewController.ClassExists) { // ios 6 preferred method var gcvc = new GKGameCenterViewController(); gcvc.gameCenterDelegate = GameCenterControllerDelegate.instance; gcvc.viewState = GKGameCenterViewControllerState.Leaderboards; gcvc.leaderboardTimeScope = GKLeaderboardTimeScope.Today; gcvc.leaderboardCategory = leaderboardID; UIApplication.SharedApplication().keyWindow.rootViewController.PresentViewController(gcvc, true, null); } else { var lbvc = new GKLeaderboardViewController(); lbvc.leaderboardDelegate = LeaderboardViewControllerDelegate.instance; lbvc.timeScope = GKLeaderboardTimeScope.Today; lbvc.category = leaderboardID; UIApplication.SharedApplication().keyWindow.rootViewController.PresentViewController(lbvc, true, null); } }
public override void DidFinish(GKLeaderboardViewController viewController) { var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var navController = appDelegate.NavController; navController.DismissModalViewControllerAnimated(true); }
public override void ViewDidLoad () { base.ViewDidLoad (); // Perform any additional setup after loading the view, typically from a nib. initGameCenter (); string[] categories = { "Easy", "Hard", "Awesome" }; UIActionSheet selectCategory = new UIActionSheet ("Choose Leaderboard", null, "Cancel", null, categories); selectCategory.Dismissed += (sender, e) => { switch (e.ButtonIndex) { case 0: currentCategory = EasyLeaderboardID; this.selectLeaderBoardButton.SetTitle ("Leaderboard: Easy", UIControlState.Normal); currentScore = 0; currentScoreTextField.Text = "0"; break; case 1: currentCategory = HardLeaderboardID; this.selectLeaderBoardButton.SetTitle ("Leaderboard: Hard", UIControlState.Normal); currentScore = 0; currentScoreTextField.Text = "0"; break; case 2: currentCategory = AwesomeLeaderboardID; this.selectLeaderBoardButton.SetTitle ("Leaderboard: Awesome", UIControlState.Normal); currentScore = 0; currentScoreTextField.Text = "0"; break; default: break; } currentLeaderBoard = gameCenterManager.reloadLeaderboard (currentCategory); updateHighScore (); }; this.selectLeaderBoardButton.TouchUpInside += (sender, e) => { selectCategory.ShowInView (this.View); }; this.showLeaderboardButton.TouchUpInside += (sender, e) => { GKLeaderboardViewController leaderboardController = new GKLeaderboardViewController (); leaderboardController.Category = currentCategory; leaderboardController.TimeScope = GKLeaderboardTimeScope.AllTime; leaderboardController.DidFinish += (senderLeaderboard, eLeaderboard) => { leaderboardController.DismissViewController (true, null); }; PresentViewController (leaderboardController, true, null); }; this.showAchievementButton.TouchUpInside += (sender, e) => { GKAchievementViewController achievementController = new GKAchievementViewController (); achievementController.DidFinish += (senderAchievement, eAchievement) => { achievementController.DismissViewController (true, null); }; PresentViewController (achievementController, true, null); }; this.incrementScoreButton.TouchUpInside += (sender, e) => { currentScore++; currentScoreTextField.Text = currentScore.ToString (); checkAchievements (); }; this.submitScoreButton.TouchUpInside += (sender, e) => { if (currentScore > 0) gameCenterManager.reportScore (currentScore, currentCategory, this); }; this.resetButton.TouchUpInside += (sender, e) => { gameCenterManager.resetAchievement (); }; }
public static void ShowLeaderboard() { AssertInitialised (); if ( ( Gamer.SignedInGamers.Count > 0 ) && ( Gamer.SignedInGamers[0].IsSignedInToLive ) ) { // Lazy load it if ( leaderboardController == null ) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); IsVisible = false; TouchPanel.EnabledGestures=prevGestures; }; if (_window != null) { if(viewController == null) { viewController = new GuideViewController(_gameViewController); _window.Add(viewController.View); viewController.View.Hidden = true; } prevGestures=TouchPanel.EnabledGestures; TouchPanel.EnabledGestures=GestureType.None; viewController.PresentModalViewController(leaderboardController, true); IsVisible = true; } } } else { UIAlertView alert = new UIAlertView("Error","You need to be logged into Game Center to view the Leaderboard.",null,"Ok"); alert.Show(); ShowSignIn(1,true); } }
public static void ShowLeaderboard() { if ( ( Gamer.SignedInGamers.Count > 0 ) && ( Gamer.SignedInGamers[0].IsSignedInToLive ) ) { // Lazy load it if ( leaderboardController == null ) { leaderboardController = new GKLeaderboardViewController(); } if (leaderboardController != null) { leaderboardController.DidFinish += delegate(object sender, EventArgs e) { leaderboardController.DismissModalViewControllerAnimated(true); isVisible = false; }; if (Window !=null) { if(viewController == null) { viewController = new UIViewController(); Window.Add(viewController.View); viewController.View.Hidden = true; } viewController.PresentModalViewController(leaderboardController, true); isVisible = true; } } } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. InitGameCenter(); string[] categories = { "Easy", "Hard", "Awesome" }; var selectCategory = new UIActionSheet("Choose Leaderboard", null, "Cancel", null, categories); selectCategory.Dismissed += (sender, e) => { switch (e.ButtonIndex) { case 0: currentCategory = EasyLeaderboardID; this.selectLeaderBoardButton.SetTitle("Leaderboard: Easy", UIControlState.Normal); currentScore = 0; currentScoreTextField.Text = "0"; break; case 1: currentCategory = HardLeaderboardID; this.selectLeaderBoardButton.SetTitle("Leaderboard: Hard", UIControlState.Normal); currentScore = 0; currentScoreTextField.Text = "0"; break; case 2: currentCategory = AwesomeLeaderboardID; this.selectLeaderBoardButton.SetTitle("Leaderboard: Awesome", UIControlState.Normal); currentScore = 0; currentScoreTextField.Text = "0"; break; default: break; } currentLeaderBoard = gameCenterManager.ReloadLeaderboard(currentCategory); UpdateHighScore(); }; selectLeaderBoardButton.TouchUpInside += (sender, e) => selectCategory.ShowInView(this.View); showLeaderboardButton.TouchUpInside += (sender, e) => { var leaderboardController = new GKLeaderboardViewController(); leaderboardController.Category = currentCategory; leaderboardController.TimeScope = GKLeaderboardTimeScope.AllTime; leaderboardController.DidFinish += (senderLeaderboard, eLeaderboard) => leaderboardController.DismissViewController(true, null); PresentViewController(leaderboardController, true, null); }; showAchievementButton.TouchUpInside += (sender, e) => { var achievementController = new GKAchievementViewController(); achievementController.DidFinish += (senderAchievement, eAchievement) => achievementController.DismissViewController(true, null); PresentViewController(achievementController, true, null); }; incrementScoreButton.TouchUpInside += (sender, e) => { currentScore++; currentScoreTextField.Text = currentScore.ToString(); CheckAchievements(); }; submitScoreButton.TouchUpInside += (sender, e) => { if (currentScore > 0) { gameCenterManager.ReportScore(currentScore, currentCategory, this); } }; resetButton.TouchUpInside += (sender, e) => gameCenterManager.ResetAchievement(); }
public static void ShowLeaderboard() { AssertInitialised(); if ((Gamer.SignedInGamers.Count > 0) && (Gamer.SignedInGamers[0].IsSignedInToLive)) { if (!UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) { // GKLeaderboardViewController for iOS 5 and older var leaderboardController = new GKLeaderboardViewController(); leaderboardController.DidFinish += delegate(object sender, EventArgs e) { HideViewController(leaderboardController); }; ShowViewController(leaderboardController); } else { // GKGameCenterViewController for iOS 6+ var gameCenterController = new GKGameCenterViewController(); gameCenterController.Finished += delegate(object sender, EventArgs e) { HideViewController(gameCenterController); }; gameCenterController.ViewState = GKGameCenterViewControllerState.Leaderboards; ShowViewController(gameCenterController); } } else { UIAlertView alert = new UIAlertView("Error", "You must be signed in to Game Center to view leaderboards.", null, "OK"); alert.Show(); ShowSignIn(1, true); } }
// private GKAchievementViewController m_gkAchievementview; /// <summary> /// Display Game center leaderboards /// </summary> /// <param name="id">Identifier.</param> /// <param name="callback">Callback.</param> public void ShowLeaderboards(string id, Action callback) { if (PlayerCache.Instance.AuthenticatedPlayer.IsAuthenticated) { if (m_gkLeaderboardview == null) { m_gkLeaderboardview = new GKLeaderboardViewController(); } m_gkLeaderboardview.Category = id; if (m_gkLeaderboardview != null) { m_gkLeaderboardview.DidFinish += delegate(object sender, EventArgs e) { m_gkLeaderboardview.DismissViewController(true, null); m_gkLeaderboardview = null; if (callback != null) { callback(); } }; Window.RootViewController.PresentViewController(m_gkLeaderboardview, true, null); } } }