Exemplo n.º 1
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bgrect = bounds.ToSubRectangleSouth(Height * 2);

            if (_cogMovement > 0)
            {
                sbatch.DrawCentered(Textures.CannonCogBig, bounds.BottomRight - RAD_INSET - PAD_VEC * (1.5f * (1 - _cogMovement)), FONTSIZE, FONTSIZE, FlatColors.Clouds * _fadeOutAlpha * _fadeOutAlpha * _fadeOutAlpha, _rotation);
            }

            SimpleRenderHelper.DrawRoundedRect(sbatch, bgrect.AsDeflated(HUD.PixelWidth * 1), Background * _fadeOutAlpha, CORNER_RADIUS);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, bgrect, Outline * _fadeOutAlpha, 12, HUD.PixelWidth * 2, CORNER_RADIUS);

            FontRenderHelper.DrawTextCentered(sbatch, _font, FONTSIZE, _text, Foreground * _fadeOutAlpha, bounds.Center);

            foreach (var particle in _particles)
            {
                if (particle.RemainingLifetime < PARTICLE_LIFETIME_FADE)
                {
                    sbatch.DrawCentered(Textures.TexPixel, particle.Position, particle.Size.Width, particle.Size.Height, particle.Color * (particle.RemainingLifetime / PARTICLE_LIFETIME_FADE), particle.Rotation);
                }
                else
                {
                    sbatch.DrawCentered(Textures.TexPixel, particle.Position, particle.Size.Width, particle.Size.Height, particle.Color, particle.Rotation);
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            SimpleRenderHelper.DrawSimpleRect(sbatch, FRectangle.CreateByCenter(Position, DIAMETER, DIAMETER), clickAreaThis.IsMouseDown() ? FlatColors.WetAsphalt : FlatColors.Asbestos);
            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, FRectangle.CreateByCenter(Position, DIAMETER, DIAMETER), 2, FlatColors.MidnightBlue);

            SimpleRenderHelper.DrawRoundedRect(sbatch, FRectangle.CreateByCenter(Position, INNER_DIAMETER, INNER_DIAMETER), Color.Black);

            FontRenderHelper.DrawTextCenteredWithBackground(
                sbatch,
                Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH,
                L10N.T(L10NImpl.STR_GLOB_OVERWORLD),
                FlatColors.TextHUD,
                Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH),
                FlatColors.BackgroundHUD2 * 0.5f);
        }
Exemplo n.º 3
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            if (node == null)
            {
                return;
            }

            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, Color.Black * 0.8f * progressDisplay, true, false, false, false, 16);

            sbatch.DrawLine(Position + new Vector2(0, HEADER_HEIGHT), Position + new Vector2(Width, HEADER_HEIGHT), FlatColors.MidnightBlue * progressDisplay, 2);

            sbatch.DrawLine(Position + new Vector2(1 * (Width / 3f), 0), Position + new Vector2(1 * (Width / 3f), 32), FlatColors.MidnightBlue * progressDisplay, 2);
            sbatch.DrawLine(Position + new Vector2(2 * (Width / 3f), 0), Position + new Vector2(2 * (Width / 3f), 32), FlatColors.MidnightBlue * progressDisplay, 2);

            FontRenderHelper.DrawTextCentered(sbatch, (tab == 0 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header1), (tab == 0 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(1 * (Width / 6f), HEADER_HEIGHT / 2f));
            FontRenderHelper.DrawTextCentered(sbatch, (tab == 1 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header2), (tab == 1 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(3 * (Width / 6f), HEADER_HEIGHT / 2f));
            FontRenderHelper.DrawTextCentered(sbatch, (tab == 2 ? Textures.HUDFontBold : Textures.HUDFontRegular), 32, L10N.T(_header3), (tab == 2 ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay, Position + new Vector2(5 * (Width / 6f), HEADER_HEIGHT / 2f));

            if (tab == 0)
            {
                // Best time local

                DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, node.LevelData.GetTimeString(FractionDifficulty.DIFF_0, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, node.LevelData.GetTimeString(FractionDifficulty.DIFF_1, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, node.LevelData.GetTimeString(FractionDifficulty.DIFF_2, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, node.LevelData.GetTimeString(FractionDifficulty.DIFF_3, true), true);
            }
            else if (tab == 1)
            {
                // Best time global

                DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalBestTime, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalBestTime, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalBestTime, true), true);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, TimeExtension.FormatMilliseconds(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalBestTime, true), true);
            }
            else if (tab == 2)
            {
                // global count

                DrawInfoLine(sbatch, FractionDifficulty.DIFF_0, 0, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_0].GlobalCompletionCount), false);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_1, 1, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_1].GlobalCompletionCount), false);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_2, 2, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_2].GlobalCompletionCount), false);
                DrawInfoLine(sbatch, FractionDifficulty.DIFF_3, 3, PositiveOrZero(node.LevelData.Data[FractionDifficulty.DIFF_3].GlobalCompletionCount), false);
            }
        }
Exemplo n.º 4
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            SimpleRenderHelper.DrawSimpleRect(sbatch, FRectangle.CreateByCenter(Position, DIAMETER, DIAMETER), clickAreaThis.IsMouseDown() ? FlatColors.WetAsphalt : FlatColors.Asbestos);
            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, FRectangle.CreateByCenter(Position, DIAMETER, DIAMETER), 2, FlatColors.MidnightBlue);

            SimpleRenderHelper.DrawRoundedRect(sbatch, FRectangle.CreateByCenter(Position, INNER_DIAMETER, INNER_DIAMETER), NodeEnabled ? ColorMath.Blend(Color.Black, FlatColors.Background, ColorOverdraw) : FlatColors.Asbestos);

            FontRenderHelper.DrawTextCenteredWithBackground(
                sbatch,
                Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH,
                L10N.T(Levels.WORLD_NAMES[Target.ID]),
                FlatColors.TextHUD,
                Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH),
                FlatColors.BackgroundHUD2 * 0.5f);

            if (!NodeEnabled)
            {
                var scale = 1 + FloatMath.Sin(Lifetime) * 0.05f;
                sbatch.DrawCentered(Textures.TexIconLock, Position, INNER_DIAMETER * scale, INNER_DIAMETER * scale, Color.Black);
            }
        }
Exemplo n.º 5
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var hl =
                IsPointerDownOnElement ||
                (HighlightOnAlt && _owner.KeyMode == HUDKeyboard.HUDKeyboardKeyMode.Alt) ||
                (HighlightOnCapsLock && _owner.KeyMode == HUDKeyboard.HUDKeyboardKeyMode.CapsLock);

            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, hl ? HUDKeyboard.COLOR_KEY_PRESSED : HUDKeyboard.COLOR_KEY, CornerRadius);

            switch (_owner.KeyMode)
            {
            case HUDKeyboard.HUDKeyboardKeyMode.Normal:
                InternalDraw(sbatch, bounds, Text, TextAlt);
                break;

            case HUDKeyboard.HUDKeyboardKeyMode.Caps:
            case HUDKeyboard.HUDKeyboardKeyMode.CapsLock:
                InternalDraw(sbatch, bounds, TextCaps ?? Text, TextAlt);
                break;

            case HUDKeyboard.HUDKeyboardKeyMode.Alt:
                InternalDraw(sbatch, bounds, TextAlt ?? Text, null);
                break;

            default:
                SAMLog.Error("HUDKB::EnumSwitch_DD", "KeyMode = " + _owner.KeyMode);
                break;
            }

            if (CapsMarker)
            {
                var cps = (_owner.KeyMode == HUDKeyboard.HUDKeyboardKeyMode.Caps) || (_owner.KeyMode == HUDKeyboard.HUDKeyboardKeyMode.CapsLock);

                sbatch.DrawCentered(
                    StaticTextures.KeyboardCircle,
                    bounds.TopLeft + new Vector2(CornerRadius, CornerRadius) * 1.2f,
                    CornerRadius, CornerRadius,
                    cps ? HUDKeyboard.COLOR_SHIFT_ON : HUDKeyboard.COLOR_SHIFT_OFF);
            }
        }
Exemplo n.º 6
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bg = IsFocused ? ColorBackground : ColorFocused;

            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, bg, BackgoundCornerSize);

            if (Text == "" && !IsFocused)
            {
                DrawPlaceholder(sbatch, bounds, Padding + WidthPadLeft, Padding);
            }
            else
            {
                DrawText(sbatch, bounds, Padding + WidthPadLeft, Padding);
            }

            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds.ToSubRectangleWest(WidthPadLeft), ColorPadLeft, true, false, true, false, BackgoundCornerSize);

            if (Icon != null && !IconSize.IsEmpty)
            {
                sbatch.DrawCentered(Icon, new FPoint(bounds.Left + WidthPadLeft / 2, bounds.Top + bounds.Height / 2), IconSize.Height, IconSize.Width, IconColor);
            }
        }
Exemplo n.º 7
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var radiusOuter = Height / 2f;
            var radiusInner = radiusOuter * KNOB_SCALE;

            var knobPosition = new FPoint(bounds.Left + radiusOuter + (Width - 2 * radiusOuter) * _knobPosition, bounds.CenterY);
            var knobColor    = ColorMath.Blend(ColorStateOff, ColorStateOn, _knobPosition);

            var textHeight = Height / 2;

            // Background
            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, ColorBackground, radiusOuter);

            // Text[On]
            if (!string.IsNullOrWhiteSpace(TextStateOn) && _knobPosition > 0)
            {
                var pos   = new FPoint(bounds.Left + radiusOuter / 2, bounds.CenterY);
                var alpha = FloatMath.Clamp(1.5f * _knobPosition, 0f, 1f);
                if (alpha > 0)
                {
                    FontRenderHelper.DrawTextVerticallyCentered(sbatch, Font, textHeight, TextStateOn, FontColor * alpha, pos);
                }
            }

            // Text[Off]
            if (!string.IsNullOrWhiteSpace(TextStateOff) && _knobPosition < 1)
            {
                var pos   = new FPoint(bounds.Right - radiusOuter / 2, bounds.CenterY);
                var alpha = FloatMath.Clamp(1 - 1.5f * _knobPosition, 0f, 1f);
                if (alpha > 0)
                {
                    FontRenderHelper.DrawTextVerticallyCenteredRightAligned(sbatch, Font, textHeight, TextStateOff, FontColor * alpha, pos);
                }
            }

            // Knob
            sbatch.DrawCentered(StaticTextures.MonoCircle, knobPosition, radiusInner * 2, radiusInner * 2, knobColor);
        }
Exemplo n.º 8
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var scale = Size.Width * 1f / width;

            FlatRenderHelper.DrawRoundedBlurPanelBackgroundPart(sbatch, bounds, ROUNDNESS);

            if (btnIndex == 0)
            {
                sbatch.DrawScaled(
                    Textures.TexHUDButtonPauseMenuMarkerBackground,
                    Center + new Vector2(width / 2f - HUDPauseButton.DIAMETER / 2f, -(HEIGHT / 2f + MARKER_HEIGHT / 2f)) * scale,
                    scale,
                    Color.White,
                    0f);

                sbatch.DrawScaled(
                    Textures.TexHUDButtonPauseMenuMarker,
                    Center + new Vector2(width / 2f - HUDPauseButton.DIAMETER / 2f, -(HEIGHT / 2f + MARKER_HEIGHT / 2f)) * scale,
                    scale,
                    IsPressed ? FlatColors.Concrete : FlatColors.Silver,
                    0f);
            }

            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, IsPressed ? FlatColors.Concrete : FlatColors.Silver, ROUNDNESS);

            var fontBounds = Textures.HUDFontBold.MeasureString(btnText).ToFSize();

            sbatch.DrawString(
                Textures.HUDFontBold,
                btnText,
                Center + new Vector2(-width / 2f + 12 + fontScaleFactor * fontBounds.Width / 2f, 0f) * scale,
                FlatColors.Foreground,
                0f,
                fontBounds.Center,
                scale * fontScaleFactor,
                SpriteEffects.None, 0f);
        }
Exemplo n.º 9
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, Color.Black * 0.6f, 8);
     sbatch.DrawCentered(Textures.TexCircle, _icon.Center, 50, 50, FlatColors.WetAsphalt * 0.4f);
 }
Exemplo n.º 10
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, Color.Black * 0.6f, 8);
 }