public MyGuiScreenLoading(MyGuiScreenGamePlay screenToLoad, MyGuiScreenGamePlay screenToUnload, MyTexture2D textureFromConstructor) : 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_currentQuoteOfTheDay = MyQuoteOfTheDay.GetRandomQuote(); Vector2 loadingTextSize = MyGuiManager.GetNormalizedSize(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait), MyGuiConstants.LOADING_PLEASE_WAIT_SCALE); m_rotatingWheelTexture = MyGuiManager.GetLoadingTexture(); Controls.Add(new MyGuiControlRotatingWheel(this, MyGuiConstants.LOADING_PLEASE_WAIT_POSITION - new Vector2(0, 0.075f + loadingTextSize.Y), MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_rotatingWheelTexture)); m_backgroundTextureFromConstructor = textureFromConstructor; m_loadFinished = false; if (m_screenToLoad != null) { MyMinerGame.IsGameReady = false; } }
public override void LoadContent() { MyMwcLog.WriteLine("MyGuiScreenLoading.LoadContent - START"); MyMwcLog.IncreaseIndent(); AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyGuiScreenLoading::LoadContent"); // We must stop XACT sounds here, not in the background thread, because on Windows XP is safer if only // main thread uses XACT. If we do it from background thread, we won't probably hear no sound. if (MyAudio.GetMusicState() != MyMusicState.Stopped) { MyAudio.Stop(); } m_backgroundScreenTexture = m_backgroundTextureFromConstructor ?? MyTextureManager.GetTexture <MyTexture2D>(GetRandomBackgroundTexture(), flags: TextureFlags.IgnoreQuality); m_minerWarsLogoTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\MinerWarsLogoLarge", null, LoadingMode.Immediate, flags: TextureFlags.IgnoreQuality); //m_minerWarsActorsTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\MinerWarsActors", flags: TextureFlags.IgnoreQuality); if (m_screenToUnload != null) { // If there is existing screen we are trying to replace (e.g. gameplay screen), we will mark this one as unloaded, so // then remove screen method won't try to unload it and we can do it in our thread. This is also the reason why we do it // here, becasue changing IsLoaded in paralel thread can't tell us when it happens - and this must be serial. m_screenToUnload.IsLoaded = false; m_screenToUnload.CloseScreenNow(); } m_currentQuoteOfTheDay = MyQuoteOfTheDay.GetRandomQuote(); // Base load content must be called after child's load content base.LoadContent(); if (m_screenToLoad != null && !m_loadInDrawFinished && m_loadFinished) { m_screenToLoad.SetState(MyGuiScreenState.OPENING); m_screenToLoad.LoadContent(); } else { m_loadFinished = false; } AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyGuiScreenLoading.LoadContent - END"); }
public MyGuiScreenUnloading(MyGuiScreenGamePlay screenToUnload, MyGuiScreenBase screenToShowAfter) : base(Vector2.Zero, null, null) { m_screenToUnload = screenToUnload; m_closeOnEsc = false; DrawMouseCursor = false; m_loadInDrawFinished = false; m_drawEvenWithoutFocus = true; m_currentQuoteOfTheDay = MyQuoteOfTheDay.GetRandomQuote(); Vector2 loadingTextSize = MyGuiManager.GetNormalizedSize(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait), MyGuiConstants.LOADING_PLEASE_WAIT_SCALE); m_rotatingWheelTexture = MyGuiManager.GetLoadingTexture(); Controls.Add(new MyGuiControlRotatingWheel(this, MyGuiConstants.LOADING_PLEASE_WAIT_POSITION - new Vector2(0, 0.075f + loadingTextSize.Y), MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_rotatingWheelTexture)); m_loadFinished = false; MyMinerGame.IsGameReady = false; m_screenToShowAfter = screenToShowAfter; }