public static void StartLoading(Action loadingAction) { var newGameplayScreen = new MyGuiScreenGamePlay(); newGameplayScreen.OnLoadingAction += loadingAction; var loadScreen = new MyGuiScreenLoading(newGameplayScreen, MyGuiScreenGamePlay.Static); loadScreen.OnScreenLoadingFinished += delegate { MyModAPIHelper.OnSessionLoaded(); MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.HUDScreen)); }; MyGuiSandbox.AddScreen(loadScreen); }
public override void UnloadContent() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyGuiScreenLoading::UnloadContent"); // This is just for case that whole application is quiting after Alt+F4 or something // Don't try to unload content in that thread or something - we don't know in what state it is. Just abort it. if (m_backgroundScreenTexture != null) { VRageRender.MyRenderProxy.UnloadTexture(m_backgroundScreenTexture); } if (m_backgroundTextureFromConstructor != null) { VRageRender.MyRenderProxy.UnloadTexture(m_backgroundTextureFromConstructor); } if (m_backgroundScreenTexture != null) { VRageRender.MyRenderProxy.UnloadTexture(m_rotatingWheelTexture); } if (m_screenToLoad != null && !m_loadFinished && m_loadInDrawFinished) { // Call unload because there might be running precalc threads and we need to stop them //m_screenToLoad.UnloadObjects(); m_screenToLoad.UnloadContent(); m_screenToLoad.UnloadData(); //m_screenToLoad.UnloadData(); m_screenToLoad = null; } if (m_screenToLoad != null && !m_loadInDrawFinished) { m_screenToLoad.UnloadContent(); } VRageRender.MyRenderProxy.LimitMaxQueueSize = false; base.UnloadContent(); System.Diagnostics.Debug.Assert(Static == this); Static = null; VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
public MyGuiScreenLoading(MyGuiScreenGamePlay screenToLoad, MyGuiScreenGamePlay screenToUnload, string textureFromConstructor, string customText = null) : base(Vector2.Zero, null, null) { MyLoadingPerformance.Instance.StartTiming(); System.Diagnostics.Debug.Assert(Static == null); Static = this; m_screenToLoad = screenToLoad; m_screenToUnload = screenToUnload; m_closeOnEsc = false; DrawMouseCursor = false; m_loadInDrawFinished = false; m_drawEvenWithoutFocus = true; m_currentQuote = MyLoadingScreenQuote.GetRandomQuote(); m_isFirstForUnload = true; // Has to be done because of HW Cursor MyGuiSandbox.SetMouseCursorVisibility(false); m_rotatingWheelTexture = MyGuiConstants.LOADING_TEXTURE_LOADING_SCREEN; m_backgroundTextureFromConstructor = textureFromConstructor; m_customTextFromConstructor = customText; m_loadFinished = false; //MyAudio.Static.Mute = true; if (m_screenToLoad != null) { MySandboxGame.IsUpdateReady = false; MySandboxGame.AreClipmapsReady = MySandboxGame.IsDedicated; } m_authorWithDash = new StringBuilder(); RecreateControls(true); }
public MyGuiScreenLoading(MyGuiScreenGamePlay screenToLoad, MyGuiScreenGamePlay screenToUnload, string textureFromConstructor, string customText = null) : base(Vector2.Zero, null, null) { MyLoadingPerformance.Instance.StartTiming(); System.Diagnostics.Debug.Assert(Static == null); Static = this; m_screenToLoad = screenToLoad; m_screenToUnload = screenToUnload; m_closeOnEsc = false; DrawMouseCursor = false; m_loadInDrawFinished = false; m_drawEvenWithoutFocus = true; m_currentQuote = MyLoadingScreenQuote.GetRandomQuote(); m_isFirstForUnload = true; // Has to be done because of HW Cursor MyGuiSandbox.SetMouseCursorVisibility(false); m_rotatingWheelTexture = MyGuiConstants.LOADING_TEXTURE_LOADING_SCREEN; m_backgroundTextureFromConstructor = textureFromConstructor; m_customTextFromConstructor = customText; m_loadFinished = false; //MyAudio.Static.Mute = true; if (m_screenToLoad != null) { MySandboxGame.IsUpdateReady = false; MySandboxGame.AreClipmapsReady = MySandboxGame.IsDedicated; } m_authorWithDash = new StringBuilder(); RecreateControls(true); }
public override void UnloadContent() { VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyGuiScreenLoading::UnloadContent"); // This is just for case that whole application is quiting after Alt+F4 or something // Don't try to unload content in that thread or something - we don't know in what state it is. Just abort it. if (m_backgroundScreenTexture != null) VRageRender.MyRenderProxy.UnloadTexture(m_backgroundScreenTexture); if (m_backgroundTextureFromConstructor != null) VRageRender.MyRenderProxy.UnloadTexture(m_backgroundTextureFromConstructor); if (m_backgroundScreenTexture != null) VRageRender.MyRenderProxy.UnloadTexture(m_rotatingWheelTexture); if (m_screenToLoad != null && !m_loadFinished && m_loadInDrawFinished) { // Call unload because there might be running precalc threads and we need to stop them //m_screenToLoad.UnloadObjects(); m_screenToLoad.UnloadContent(); m_screenToLoad.UnloadData(); //m_screenToLoad.UnloadData(); m_screenToLoad = null; } if (m_screenToLoad != null && !m_loadInDrawFinished) { m_screenToLoad.UnloadContent(); } VRageRender.MyRenderProxy.LimitMaxQueueSize = false; base.UnloadContent(); System.Diagnostics.Debug.Assert(Static == this); Static = null; VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); }
public static void StartLoading(Action loadingAction) { MyAnalyticsHelper.LoadingStarted(); var newGameplayScreen = new MyGuiScreenGamePlay(); newGameplayScreen.OnLoadingAction += loadingAction; var loadScreen = new MyGuiScreenLoading(newGameplayScreen, MyGuiScreenGamePlay.Static); loadScreen.OnScreenLoadingFinished += delegate { MyModAPIHelper.OnSessionLoaded(); MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.HUDScreen)); }; MyGuiSandbox.AddScreen(loadScreen); }