예제 #1
0
        private void DrawNotifications(int visibleCount)
        {
            var notificationPosition = Position;
            int textIdx = 0;

            for (int i = MAX_PRIORITY; i >= 0; --i)
            {
                List <MyHudNotificationBase> notifications;
                m_notificationsByPriority.TryGetValue(i, out notifications);
                if (notifications == null)
                {
                    continue;
                }

                foreach (var notification in notifications)
                {
                    if (!IsDrawn(notification))
                    {
                        continue;
                    }

                    MyGuiManager.DrawString(notification.Font, m_texts[textIdx], notificationPosition,
                                            MyGuiSandbox.GetDefaultTextScaleWithLanguage(), Color.White,
                                            MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyVideoSettingsManager.IsTripleHead());
                    notificationPosition.Y += m_textSizes[textIdx].Y;
                    ++textIdx;
                    --visibleCount;
                    if (visibleCount == 0)
                    {
                        return;
                    }
                }
            }
        }
 public override void Draw()
 {
     if (_currentMessage.HasValue)
     {
         MyGuiManager.DrawString("Debug", _currentMessage.Value.Text, _position,
                                 MyGuiSandbox.GetDefaultTextScaleWithLanguage() * 1.2f, _currentMessage.Value.Color,
                                 MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyVideoSettingsManager.IsTripleHead());
     }
 }
        private void DrawInternal()
        {
            Color colorQuote = new Color(255, 255, 255, 250);     //  White

            colorQuote.A = (byte)(colorQuote.A * m_transitionAlpha);
            {
                //////////////////////////////////////////////////////////////////////
                //  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(1f, 1f, 1f, m_transitionAlpha)));
                MyGuiManager.DrawSpriteBatch(MyGuiConstants.TEXTURE_BACKGROUND_FADE, backgroundRectangle, new Color(new Vector4(1f, 1f, 1f, m_transitionAlpha)));

                //  Game logo
                MyGuiSandbox.DrawGameLogo(m_transitionAlpha);
            }

            LastBackgroundTexture = m_backgroundScreenTexture;

            //  Loading Please Wait
            MyGuiManager.DrawString(m_font, MyTexts.Get(MyCommonTexts.LoadingPleaseWaitUppercase),
                                    MyGuiConstants.LOADING_PLEASE_WAIT_POSITION, MyGuiSandbox.GetDefaultTextScaleWithLanguage() * MyGuiConstants.LOADING_PLEASE_WAIT_SCALE, new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * m_transitionAlpha),
                                    MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);

            // Draw quote
            {
                if (string.IsNullOrEmpty(m_customTextFromConstructor))
                {
                    var font = m_font;
                    var controlBottomLeft = m_quoteTextControl.GetPositionAbsoluteBottomLeft();
                    var textSize          = m_quoteTextControl.TextSize;
                    var controlSize       = m_quoteTextControl.Size;
                    var authorTopLeft     = controlBottomLeft +
                                            new Vector2((controlSize.X - textSize.X) * 0.5f + 0.025f, 0.025f);
                    MyGuiManager.DrawString(font, m_authorWithDash, authorTopLeft,
                                            MyGuiSandbox.GetDefaultTextScaleWithLanguage());
                }
                m_quoteTextControl.Draw(1, 1);
            }
        }
예제 #4
0
        public void DrawTexts()
        {
            if (m_texts.GetAllocatedCount() <= 0)
            {
                return;
            }

            for (int i = 0; i < m_texts.GetAllocatedCount(); i++)
            {
                MyHudText text = m_texts.GetAllocatedItem(i);

                var font = text.Font;
                text.Position /= MyGuiManager.GetHudSize();
                var normalizedCoord = ConvertHudToNormalizedGuiPosition(ref text.Position);

                Vector2 textSize = MyGuiManager.MeasureString(font, text.GetStringBuilder(), MyGuiSandbox.GetDefaultTextScaleWithLanguage());
                textSize.X *= 0.9f;
                textSize.Y *= 0.7f;
                MyGuiScreenHudBase.DrawFog(ref normalizedCoord, ref textSize);

                MyGuiManager.DrawString(font, text.GetStringBuilder(), normalizedCoord, text.Scale, colorMask: text.Color, drawAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }

            m_texts.ClearAllAllocated();
        }
예제 #5
0
        public void DrawTexts()
        {
            if (m_texts.GetAllocatedCount() <= 0)
            {
                return;
            }

            for (int i = 0; i < m_texts.GetAllocatedCount(); i++)
            {
                MyHudText text = m_texts.GetAllocatedItem(i);
                if (text.GetStringBuilder().Length == 0)
                {
                    continue;
                }

                var font = text.Font;
                text.Position /= MyGuiManager.GetHudSize();
                var normalizedCoord = ConvertHudToNormalizedGuiPosition(ref text.Position);

                Vector2 textSize = MyGuiManager.MeasureString(font, text.GetStringBuilder(), MyGuiSandbox.GetDefaultTextScaleWithLanguage());
                textSize *= text.Scale;
                MyGuiTextShadows.DrawShadow(ref normalizedCoord, ref textSize, null, text.Color.A / 255f, text.Alignement);
                MyGuiManager.DrawString(font, text.GetStringBuilder(), normalizedCoord, text.Scale, colorMask: text.Color, drawAlign: text.Alignement);
            }

            m_texts.ClearAllAllocated();
        }
예제 #6
0
        private void ProcessBeforeDraw(out int visibleCount)
        {
            ClearTexts();

            visibleCount = 0;
            for (int i = MAX_PRIORITY; i >= 0; --i)
            {
                List <MyHudNotificationBase> notifications;
                m_notificationsByPriority.TryGetValue(i, out notifications);
                if (notifications == null)
                {
                    continue;
                }

                foreach (var notification in notifications)
                {
                    if (!IsDrawn(notification))
                    {
                        continue;
                    }

                    StringBuilder messageStringBuilder = m_textsPool.Allocate();
                    Debug.Assert(messageStringBuilder != null);

                    messageStringBuilder.Append(notification.GetText());

                    Vector2 textSize = MyGuiManager.MeasureString(notification.Font, messageStringBuilder, MyGuiSandbox.GetDefaultTextScaleWithLanguage());

                    m_textSizes.Add(textSize);
                    m_texts.Add(messageStringBuilder);
                    ++visibleCount;
                    if (visibleCount == MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT)
                    {
                        return;
                    }
                }
            }
        }