public override bool Draw(float backgroundFadeAlpha)
        {
            if (base.Draw(backgroundFadeAlpha) == false)
            {
                return(false);
            }

            if (m_videoPlayer != null)
            {
                m_videoPlayer.Update();

                Texture texture = m_videoPlayer.OutputFrame;

                Vector4 color = m_colorMultiplier * m_transitionAlpha;

                Rectangle videoRect;
                MyGuiManager.GetSafeAspectRatioFullScreenPictureSize(new MyMwcVector2Int(texture.GetLevelDescription(0).Width, texture.GetLevelDescription(0).Height), out videoRect);

                MyGuiManager.DrawSpriteBatch(texture, videoRect, new Color(color));

                if (m_subtitleToDraw != null)
                {
                    MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsWhite(), m_subtitleToDraw,
                                                    new Vector2(0.5f, 0.85f), 1.6f, Color.White, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);
                }
            }

            return(true);
        }
Esempio n. 2
0
        public bool DrawLoading(float backgroundFadeAlpha)
        {
            m_transitionAlpha = 1.0f;

            MyMinerGame.Static.GraphicsDevice.Clear(ClearFlags.Target, new SharpDX.ColorBGRA(0), 0, 0);

            Color colorQuote = new Color(255, 255, 255, 250);     //  White

            colorQuote.A = (byte)(colorQuote.A * m_transitionAlpha);
            //if (m_backgroundTextureFromConstructor == null)
            {
                //////////////////////////////////////////////////////////////////////
                //  Normal loading screen
                //////////////////////////////////////////////////////////////////////

                //  Random background texture
                Rectangle backgroundRectangle;
                MyGuiManager.GetSafeHeightFullScreenPictureSize(MyGuiConstants.LOADING_BACKGROUND_TEXTURE_REAL_SIZE, out backgroundRectangle);
                MyGuiManager.DrawSpriteBatch(m_backgroundScreenTexture, backgroundRectangle, new Color(new Vector4(0.95f, 0.95f, 0.95f, m_transitionAlpha)));

                //  Miner Wars logo
                DrawMinerWarsLogo();

                //  Current version:
                //DrawAppVersion();
                //DrawGlobalVersionText();

                //  Quote of the day or something
                MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), (new System.Text.StringBuilder()).Append(MyTextsWrapper.Get(MyTextsWrapperEnum.Tip)).Append(" ").Append(MyTextsWrapper.Get(m_currentQuoteOfTheDay)),
                                                new Vector2(0.5f, 0.55f), 1.15f, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }

            LastBackgroundTexture = m_backgroundScreenTexture;

            //  Loading Please Wait
            MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait),
                                    MyGuiConstants.LOADING_PLEASE_WAIT_POSITION, MyGuiConstants.LOADING_PLEASE_WAIT_SCALE, new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * GetTransitionAlpha()),
                                    MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);

            if (base.Draw(backgroundFadeAlpha) == false)
            {
                return(false);
            }


            return(true);
        }
        public bool DrawLoading(float backgroundFadeAlpha)
        {
            //MyAudio.Update(true);
            m_transitionAlpha = 1.0f;

            MyMinerGame.Static.GraphicsDevice.Clear(ClearFlags.Target, new SharpDX.ColorBGRA(0), 0, 0);

            Color colorQuote = new Color(255, 255, 255, 250);     //  White

            colorQuote.A = (byte)(colorQuote.A * m_transitionAlpha);
            //if (m_backgroundTextureFromConstructor == null)
            {
                //////////////////////////////////////////////////////////////////////
                //  Normal loading screen
                //////////////////////////////////////////////////////////////////////

                MyTextsWrapperEnum sectorName        = MyTextsWrapperEnum.Null;
                MyTextsWrapperEnum sectorDescription = MyTextsWrapperEnum.Null;
                MyTexture2D        sectorTexture     = null;

                bool descriptionAvailable = false;
                if (m_screenToLoad != null)
                {
                    var position = m_screenToLoad.GetSectorIdentifier().Position;
                    descriptionAvailable = GetSectorDescription(position, out sectorName, out sectorDescription, out sectorTexture);
                }
                else if (MyGuiScreenGamePlay.Static != null)
                {
                    var position = MyGuiScreenGamePlay.Static.GetSectorIdentifier().Position;
                    descriptionAvailable = GetSectorDescription(position, out sectorName, out sectorDescription, out sectorTexture);
                }
                else
                {
                    descriptionAvailable = false;
                }



                //  Random background texture
                Rectangle backgroundRectangle;
                MyGuiManager.GetSafeHeightFullScreenPictureSize(MyGuiConstants.LOADING_BACKGROUND_TEXTURE_REAL_SIZE, out backgroundRectangle);
                MyGuiManager.DrawSpriteBatch(descriptionAvailable ? sectorTexture : m_backgroundScreenTexture, backgroundRectangle, new Color(new Vector4(0.95f, 0.95f, 0.95f, m_transitionAlpha)));

                //  Miner Wars logo
                DrawMinerWarsLogo();

                //  Current version:
                //DrawAppVersion();
                //DrawGlobalVersionText();

                if (descriptionAvailable)
                {
                    MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(sectorName),
                                                    new Vector2(0.5f, 0.4f), 1.6f, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
                    MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(sectorDescription),
                                                    new Vector2(0.5f, 0.5f), 1, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
                }
                else
                {
                    //  Quote of the day
                    MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), (new StringBuilder()).Append(MyTextsWrapper.Get(MyTextsWrapperEnum.Tip)).Append(" ").Append(MyTextsWrapper.Get(m_currentQuoteOfTheDay)),
                                                    new Vector2(0.5f, 0.5f), 1.15f, colorQuote, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
                }
            }

            /* else
             * {
             *   //////////////////////////////////////////////////////////////////////
             *   //  Loading screen when there is specified background texture is little customized
             *   //////////////////////////////////////////////////////////////////////
             *
             *   MyGuiManager.DrawSpriteBatch(m_backgroundScreenTexture, Vector2.Zero, new Color(new Vector4(0.95f, 0.95f, 0.95f, m_transitionAlpha)));
             * }*/

            LastBackgroundTexture = m_backgroundScreenTexture;

            //  Loading Please Wait
            MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait),
                                    MyGuiConstants.LOADING_PLEASE_WAIT_POSITION, MyGuiConstants.LOADING_PLEASE_WAIT_SCALE, new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * GetTransitionAlpha()),
                                    MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);

            MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), MyTextsWrapper.Get(MyTextsWrapperEnum.LongerLoadingTimes),
                                    MyGuiConstants.LOADING_PLEASE_WAIT_POSITION + new Vector2(0, 0.025f), MyGuiConstants.LOADING_PLEASE_WAIT_SCALE * 0.8f, new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * GetTransitionAlpha()),
                                    MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);


            if (base.Draw(backgroundFadeAlpha) == false)
            {
                return(false);
            }


            return(true);
        }
Esempio n. 4
0
        public override void Draw()
        {
            /*    if (MyFakes.MW25D)
             *  {
             *      Visible = true;
             *      //m_mouseCursorHoverTexture = null;
             *     // return;
             *  }
             */
            if (!Visible)
            {
                return;
            }


            MyGuiManager.BeginSpriteBatch();
            var offset = new Vector2(VideoMode.MyVideoModeManager.IsTripleHead() ? -1 : 0, 0);

            /*
             * // Draw information:
             * Vector2 screenSizeNormalize = MyGuiManager.GetNormalizedSize(MyGuiManager.GetAmmoSelectKeyConfirmBorderTexture(), MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_INFO_SCALE);
             * screenSizeNormalize.X *= MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_SCALE.X;
             * screenSizeNormalize.Y *= MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_SCALE.Y;
             */

            var screenSizeNormalize = new Vector2(918f / 1600f, 314f / 1200f);

            //if (!MyFakes.MW25D)
            if (Visible)
            {
                MyGuiManager.DrawSpriteBatch(MyGuiManager.GetAmmoSelectKeyConfirmBorderTexture(),
                                             MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_POSITION + offset, screenSizeNormalize,
                                             MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_COLOR, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

                MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), m_text,
                                                MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_TEXT_INFO_POSITION + offset, MyGuiConstants.AMMO_SELECTION_CONFIRMATION_TEXT_SCALE,
                                                MyGuiConstants.AMMO_SELECTION_CONFIRM_INFO_TEXT_COLOR, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

                MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), m_textValues,
                                        MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_TEXT_POSITION + offset, MyGuiConstants.AMMO_SELECTION_CONFIRMATION_TEXT_INFO_SCALE,
                                        MyGuiConstants.AMMO_SELECTION_CONFIRM_INFO_TEXT_COLOR, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }

            MyGuiSmallShipHelperAmmo.DrawSpriteBatchBackground(MyGuiConstants.SELECT_AMMO_BACKGROUND_COLOR);

            foreach (MyMwcObjectBuilder_AmmoGroupEnum item in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_AssignmentOfAmmo_GroupEnumValues)
            {
                MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(item).DrawSpriteBatchMenuHeader((int)item - 1, (m_selectedGroup == item), m_selectedIndex, m_backgroundColor.Value);
            }

            if (!Visible)
            {
                MyGuiManager.EndSpriteBatch();
                return;
            }

            for (int i = m_ammoTypesAmounts.Count - 1; i >= 0; i--)
            {
                int itemsPerColumn = 7;

                int orderX = i / itemsPerColumn;
                int orderY = i % itemsPerColumn;

                MyGuiSmallShipHelperAmmo ammoHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(
                    MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)m_ammoTypesAmounts[i].Type) as MyGuiSmallShipHelperAmmo;
                //MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(m_ammoTypesAmounts[i].Type).DrawSpriteBatchMenuItem(
                //    orderX - 1, orderY - 1, (i == m_selectedIndex), m_ammoTypesAmounts[i].Amount, m_backgroundColor.Value, i, (int)m_selectedGroup);
                ammoHelper.DrawSpriteBatchMenuItem(orderX - 1, orderY - 1, (i == m_selectedIndex), m_ammoTypesAmounts[i].Amount, m_backgroundColor.Value, i, (int)m_selectedGroup);
            }


            MyGuiSmallShipHelperAmmo.DrawSpriteBatchTooltip();

            MyGuiManager.EndSpriteBatch();
        }