コード例 #1
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     if (progressMove > 0)
     {
         SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, Color.Black * 0.6f);
     }
 }
コード例 #2
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bottomrect = bounds.ToSubRectangleSouth(25);

            {             // background
                SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
                SimpleRenderHelper.DrawSimpleRect(sbatch, bottomrect, FlatColors.Concrete);
            }

            {             // name
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 32, _meta?.LevelName ?? _level?.FullName, (_meta == null) ? FlatColors.Silver : FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5, bounds.Top + (bounds.Height - 25) / 2));
            }

            {             // user
                sbatch.DrawCentered(Textures.TexHUDIconGenericUser, new FPoint(bottomrect.Left + 5 + 32 + 5, bottomrect.CenterY), 20, 20, (_meta == null) ? FlatColors.Silver : FlatColors.WetAsphalt);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 20, (_meta == null) ? L10N.T(L10NImpl.STR_INF_YOU) : (_meta.Username ?? "Unknown"), (_meta == null) ? FlatColors.Silver : FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5 + 16, bounds.Bottom - 12.5f));
            }


            if ((_meta != null) && _meta.GridSize != SCCMLevelData.SIZES[0])             // [XL] marker
            {
                var rr = bounds.ToSubRectangleSouthWest(32, 20);
                SimpleRenderHelper.DrawSimpleRect(sbatch, rr, FlatColors.Amethyst);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.HUDFontRegular, "XL", rr, 0, true, FlatColors.Foreground);
            }

            {             // star counter
                var pointPos = new FPoint(bottomrect.Right - 100, bottomrect.CenterY);
                sbatch.DrawCentered(Textures.TexIconStar, pointPos, 20, 20, FlatColors.SunFlower);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 24, (_meta == null) ? "???" : _meta.Stars.ToString(), (_meta == null) ? FlatColors.Silver : FlatColors.MidnightBlue, pointPos + new Vector2(16, 0));
            }

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
        }
コード例 #3
0
        protected void DrawGridProgress(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            var scoreRectSize = innerBounds.Width / 8f;

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var col = ColorMath.Blend(FlatColors.Background, GetCellColor(x, y), AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            for (int i = 0; i <= 8; i++)
            {
                sbatch.DrawLine(innerBounds.Left, innerBounds.Top + i * scoreRectSize, innerBounds.Right, innerBounds.Top + i * scoreRectSize, Color.Black * AlphaOverride, Owner.PixelWidth);
                sbatch.DrawLine(innerBounds.Left + i * scoreRectSize, innerBounds.Top, innerBounds.Left + i * scoreRectSize, innerBounds.Bottom, Color.Black * AlphaOverride, Owner.PixelWidth);
            }

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
コード例 #4
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            if (!MainGame.Inst.Profile.GetLevelData(Levels.LEVEL_TUTORIAL.UniqueID).HasAnyCompleted())
            {
                var iconBounds = FRectangle.CreateByCenter(Position, new FSize(ICONSIZE + ICONSIZESWIGGLE * FloatMath.Sin(Lifetime), ICONSIZE + ICONSIZESWIGGLE * FloatMath.Sin(Lifetime)));

                FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
                SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

                sbatch.FillRectangle(innerBounds, FlatColors.Background);

                sbatch.DrawStretched(Textures.TexIconTutorial, iconBounds, Color.White * AlphaOverride);

                FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
            }
            else
            {
                var iconBounds = FRectangle.CreateByCenter(Position, new FSize(ICONSIZE, ICONSIZE));

                FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
                SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

                sbatch.FillRectangle(innerBounds, FlatColors.Background);

                sbatch.DrawStretched(Textures.TexIconTutorial, iconBounds, FlatColors.Emerald * AlphaOverride);

                FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
            }
        }
コード例 #5
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);
                }
            }
        }
コード例 #6
0
 public static void DrawMirrorWall(IBatchRenderer sbatch, FRotatedRectangle rect)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         rect,
         Color.White, Color.White, FlatColors.Concrete,
         Textures.TexMirrorBlockEdge, Textures.TexMirrorBlockCorner, Textures.TexPixel,
         MirrorBlock.CORNER_SIZE);
 }
コード例 #7
0
 public static void DrawGlassWall(IBatchRenderer sbatch, FRotatedRectangle rect)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         rect,
         Color.White, Color.White, Color.White,
         Textures.TexGlassEdge, Textures.TexGlassCorner, Textures.TexGlassFill,
         GlassBlock.CORNER_SIZE);
 }
コード例 #8
0
ファイル: MirrorBlock.cs プロジェクト: ssttv/GridDominance
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         _bounds,
         Color.White, Color.White, FlatColors.Concrete,
         Textures.TexMirrorBlockEdge, Textures.TexMirrorBlockCorner, Textures.TexPixel,
         CORNER_SIZE);
 }
コード例 #9
0
ファイル: GlassBlock.cs プロジェクト: ssttv/GridDominance
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     SimpleRenderHelper.Draw9Patch(
         sbatch,
         _bounds,
         Color.White, Color.White, Color.White,
         Textures.TexGlassEdge, Textures.TexGlassCorner, Textures.TexGlassFill,
         CORNER_SIZE);
 }
コード例 #10
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Asbestos);
            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);

            if (ScrollMax > ScrollPageSize)
            {
                var yrange = Height - 64 - 64 - 32;
                var ypos   = yrange * (ScrollPosition * 1f / (ScrollMax - ScrollPageSize));

                SimpleRenderHelper.DrawSimpleRect(sbatch, FRectangle.CreateByTopLeft(bounds.Left, bounds.Top + 64 + ypos, bounds.Width, 32), FlatColors.MidnightBlue);
            }
        }
コード例 #11
0
        protected void DrawGridGreenLock(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.FillRectangle(innerBounds, FlatColors.Background);

            sbatch.DrawCentered(Textures.TexIconLockOpen, innerBounds.Center, INNERSIZE * 0.75f, INNERSIZE * 0.75f, FlatColors.Nephritis);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
コード例 #12
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.FillRectangle(innerBounds, FlatColors.Background);

            var scoreRectSize = innerBounds.Width / 8f;

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var bc = ((x % 2 == 0) ^ (y % 2 == 0)) ? FlatColors.Background : FlatColors.BackgroundLight;

                    if (_ustate == WorldUnlockState.OpenAndUnlocked)
                    {
                        var d = FloatMath.Sqrt((x - 3.5f) * (x - 3.5f) + (y - 3.5f) * (y - 3.5f));

                        var p = 1 - (d / 4.5f);
                        if (p < 0)
                        {
                            p = 0;
                        }

                        p *= FloatMath.PercSin(_pulseTimer * FloatMath.TAU * 0.25f);

                        bc = ColorMath.Blend(bc, FlatColors.PeterRiver, p);
                    }

                    var col = ColorMath.Blend(FlatColors.Background, bc, AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            sbatch.DrawStretched(Textures.TexIconNetworkBase, innerBounds, Color.White);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex1, innerBounds, Color.White, VertexRotations[0]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex2, innerBounds, Color.White, VertexRotations[1]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex3, innerBounds, Color.White, VertexRotations[2]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex4, innerBounds, Color.White, VertexRotations[3]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex5, innerBounds, Color.White, VertexRotations[4]);

            sbatch.DrawRectangle(innerBounds, Color.Black, Owner.PixelWidth);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
コード例 #13
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);
        }
コード例 #14
0
        protected void DrawLockSwing(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.DrawRectangle(innerBounds, Color.Black);

            var rot = FloatMath.Sin(Lifetime * FloatMath.TAU / _swingPeriode) * FloatMath.RAD_POS_005;

            sbatch.DrawCentered(Textures.TexIconLock, innerBounds.Center, INNERSIZE * 0.75f, INNERSIZE * 0.75f, Color.White, rot);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.Asbestos, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
コード例 #15
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);
            }
        }
コード例 #16
0
ファイル: HUDTextBox.cs プロジェクト: ssttv/GridDominance
        protected void DrawText(IBatchRenderer sbatch, FRectangle bounds, float leftOffset, float rightOffset)
        {
            var maxWidth = bounds.Width - leftOffset - rightOffset - CursorWidth - Font.Spacing;
            var dispText = Text;

            if (IsPassword)
            {
                if (_forceShowLastChar && dispText.Length > 0)
                {
                    dispText = new string('*', dispText.Length - 1) + dispText[dispText.Length - 1];
                }
                else
                {
                    dispText = new string('*', dispText.Length);
                }
            }

            var textBounds = FontRenderHelper.MeasureStringCached(Font, dispText, FontSize);

            while (dispText.Length > 0 && textBounds.Width > maxWidth)
            {
                dispText   = Text.Substring(1);
                textBounds = FontRenderHelper.MeasureStringCached(Font, dispText, FontSize);
            }

            FontRenderHelper.DrawTextVerticallyCentered(
                sbatch,
                Font,
                FontSize,
                dispText,
                ColorText,
                new FPoint(bounds.X + leftOffset, bounds.Y + bounds.Height / 2));

            if (IsFocused && (int)(_cursorBlinkTimer / CURSOR_BLINK_TIME) % 2 == 0)
            {
                SimpleRenderHelper.DrawSimpleRect(
                    sbatch,
                    new FRectangle(
                        bounds.X + leftOffset + textBounds.Width + Font.Spacing,
                        bounds.Y + bounds.Height / 2 - FontSize / 2,
                        CursorWidth,
                        FontSize),
                    ColorText);
            }
        }
コード例 #17
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.FillRectangle(innerBounds, FlatColors.Background);

            var scoreRectSize = innerBounds.Width / 10f;

            for (int x = 0; x < 10; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    var bc = ((x % 2 == 0) ^ (y % 2 == 0)) ? FlatColors.Background : FlatColors.BackgroundLight;

                    if (_ustate == WorldUnlockState.OpenAndUnlocked)
                    {
                        var d = FloatMath.Sqrt((x - 4.5f) * (x - 4.5f) + (y - 4.5f) * (y - 4.5f));

                        var p = FloatMath.PercSin(FloatMath.PI * 3 * d / 14f - Lifetime);

                        p *= 0.25f;

                        bc = ColorMath.Blend(bc, FlatColors.PeterRiver, p);
                    }

                    var col = ColorMath.Blend(FlatColors.Background, bc, AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            foreach (var block in Blocks)
            {
                sbatch.FillRectangle(block.Item1.WithOrigin(Position), block.Item2);
            }

            sbatch.DrawRectangle(innerBounds, Color.Black, Owner.PixelWidth);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
コード例 #18
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bottomrect = bounds.ToSubRectangleSouth(25);

            SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
            SimpleRenderHelper.DrawSimpleRect(sbatch, bottomrect, FlatColors.Concrete);

            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 32, _data.Name, FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5, bounds.Top + (bounds.Height - 25) / 2));
            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 20, MainGame.Inst.Profile.OnlineUsername, FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5 + 16, bounds.Bottom - 12.5f));

            sbatch.DrawCentered(Textures.TexHUDIconGenericUser, new FPoint(bottomrect.Left + 5 + 32 + 5, bottomrect.CenterY), 20, 20, FlatColors.WetAsphalt);

            if (_data.Size != SCCMLevelData.SIZES[0])
            {
                var rr = bounds.ToSubRectangleSouthWest(32, 20);
                SimpleRenderHelper.DrawSimpleRect(sbatch, rr, FlatColors.Amethyst);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.HUDFontRegular, "XL", rr, 0, true, FlatColors.Foreground);
            }

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
        }
コード例 #19
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);
            }
        }
コード例 #20
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bottomrect = bounds.ToSubRectangleSouth(25);

            {             // background
                SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
                SimpleRenderHelper.DrawSimpleRect(sbatch, bottomrect, FlatColors.Concrete);
            }

            {             // difficulty
                var tex = (PersonalBest == null) ? Textures.TexDifficultyLineNone : FractionDifficultyHelper.GetIcon(PersonalBest.Value);
                var col = (PersonalBest == null) ? FlatColors.Silver : FractionDifficultyHelper.GetColor(PersonalBest.Value);
                sbatch.DrawCentered(tex, new FPoint(bounds.Left + 5 + 16, bounds.Top + (Height - 25 - 32) / 2 + 16), 32, 32, col);
            }

            {             // name
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 32, _meta.LevelName, FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5, bounds.Top + (bounds.Height - 25) / 2));
            }

            {             // user
                sbatch.DrawCentered(Textures.TexHUDIconGenericUser, new FPoint(bottomrect.Left + 5 + 32 + 5, bottomrect.CenterY), 20, 20, FlatColors.WetAsphalt);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 20, _meta.Username ?? "Unknown", FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5 + 16, bounds.Bottom - 12.5f));
            }


            if (_meta.GridSize != SCCMLevelData.SIZES[0])             // [XL] marker
            {
                var rr = bounds.ToSubRectangleSouthWest(32, 20);
                SimpleRenderHelper.DrawSimpleRect(sbatch, rr, FlatColors.Amethyst);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.HUDFontRegular, "XL", rr, 0, true, FlatColors.Foreground);
            }

            {             // star counter
                var pointPos = new FPoint(bottomrect.Right - 100, bottomrect.CenterY);
                sbatch.DrawCentered(Textures.TexIconStar, pointPos, 20, 20, FlatColors.SunFlower);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 24, _meta.Stars.ToString(), FlatColors.MidnightBlue, pointPos + new Vector2(16, 0));
            }

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
        }
コード例 #21
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);
            }
        }
コード例 #22
0
ファイル: HUDIconTextBox.cs プロジェクト: ssttv/GridDominance
        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);
            }
        }
コード例 #23
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);
        }
コード例 #24
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);
        }
コード例 #25
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
     SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
 }
コード例 #26
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);
 }
コード例 #27
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, Color.Black * 0.6f, 8);
 }
コード例 #28
0
        public override void Draw(IBatchRenderer sbatch)
        {
            int ioffX = -(int)(Owner.MapOffsetX / TILE_WIDTH);
            int ioffY = -(int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = MathHelper.Min(MAX_EXTENSION_X, FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH));
            int extensionY = MathHelper.Min(MAX_EXTENSION_Y, FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH));

            int countX = FloatMath.Ceiling(VAdapter.VirtualTotalWidth / TILE_WIDTH) + 1;
            int countY = FloatMath.Ceiling(VAdapter.VirtualTotalHeight / TILE_WIDTH) + 1;

            for (int ox = ioffX - extensionX; ox < ioffX + countX + extensionX; ox++)
            {
                for (int oy = ioffY - extensionY; oy < ioffY + countY + extensionY; oy++)
                {
                    var x = ox + MAX_EXTENSION_X;                     // real coords -> array coords
                    var y = oy + MAX_EXTENSION_Y;

                    if (x < 0)
                    {
                        continue;
                    }
                    if (y < 0)
                    {
                        continue;
                    }
                    if (x >= tileCountX)
                    {
                        continue;
                    }
                    if (y >= tileCountY)
                    {
                        continue;
                    }

                    var color = GetGridColor(x, y);

                    var rect = new FRectangle(ox * TILE_WIDTH, oy * TILE_WIDTH, TILE_WIDTH, TILE_WIDTH);

                    sbatch.DrawStretched(Textures.TexPixel, rect, color);
                    sbatch.DrawStretched(Textures.TexTileBorder, rect, Color.White);

#if DEBUG
                    if (DebugSettings.Get("DebugBackground"))
                    {
                        var tx = rect.X + 8;
                        var ty = rect.Y + 8;

                        sbatch.DrawString(
                            Textures.DebugFontSmall,
                            string.Format("({4}|{5})\n{0,2}: {1:000}\n[{2}]{3}", _grid[x, y].Fraction?.ToString() ?? "##", _grid[x, y].PowerCurr * 100, _grid[x, y].SourceDistance, _grid[x, y].IsNeutralDraining ? "D" : "", ox, oy),
                            new FPoint(tx, ty),
                            _grid[x, y].Fraction?.Color ?? Color.Black);

                        if (_grid[x, y].SpawnSource != null)
                        {
                            SimpleRenderHelper.DrawCross(sbatch, rect, _grid[x, y].SpawnSource.Fraction.Color * 0.5f, 2);
                        }

                        var v4tl = new Vector2(+5, +5);
                        var v4tr = new Vector2(-5, +5);
                        var v4br = new Vector2(-5, -5);
                        var v4bl = new Vector2(+5, -5);

                        if (_grid[x, y].BlockNorth)
                        {
                            sbatch.DrawLine(rect.TopLeft + v4tl, rect.TopRight + v4tr, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockEast)
                        {
                            sbatch.DrawLine(rect.TopRight + v4tr, rect.BottomRight + v4br, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockSouth)
                        {
                            sbatch.DrawLine(rect.BottomRight + v4br, rect.BottomLeft + v4bl, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockWest)
                        {
                            sbatch.DrawLine(rect.BottomLeft + v4bl, rect.TopLeft + v4tl, Color.Yellow * 0.6f, 4);
                        }
                    }
#endif
                }
            }
        }