/// <summary> /// Starts new level or exit to High Score /// </summary> /// <param name="input"></param> private void StartNewLevelOrExit(InputState input) { // If there is no next level - go to high score screen if (!difficultyMode.HasValue) { // If is in high score, gets is name if (GameplayScreen.FinalScore != 0 && HighScoreScreen.IsInHighscores(GameplayScreen.FinalScore)) { Guide.BeginShowKeyboardInput(PlayerIndex.One, "Player Name", "What is your name (max 15 characters)?", "Player", AfterPlayerEnterName, null); } else { foreach (GameScreen screen in ScreenManager.GetScreens()) { screen.ExitScreen(); } ScreenManager.AddScreen(new BackgroundScreen("highScoreScreen"), null); ScreenManager.AddScreen(new HighScoreScreen(), null); } } // If not already loading else if (!isLoading) { #if MONOMAC // Start loading the resources on main thread // If not then all sorts of errors happen for // AutoReleasPools and OpenGL does not handle // multiple thread to well when using Thread MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread(delegate { gameplayScreen.LoadAssets(); isLoading = false; assetsLoaded = true; }); #else // Start loading the resources in an additional thread thread = new Thread(new ThreadStart(gameplayScreen.LoadAssets)); isLoading = true; thread.Start(); #endif } }
private void LoadResources() { #if MAC // Start loading the resources on main thread // If not then all sorts of errors happen for // AutoReleasPools and OpenGL does not handle // multiple thread to well when using Thread MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread(delegate { gameplayScreen.LoadAssets(); isLoading = false; assetsLoaded = true; }); #else // Start loading the resources in an additional thread thread = new Thread(new ThreadStart(gameplayScreen.LoadAssets)); thread.Start(); isLoading = true; #endif }