Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
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);
                }
            }
        }
Ejemplo n.º 3
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));
            }
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
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));
        }
Ejemplo n.º 9
0
 private void InternalDraw(IBatchRenderer sbatch, FRectangle bounds, string textBase, string textAlt)
 {
     if (Icon != null)
     {
         var b = Icon.Size().Underfit(bounds.Size, IconPadding);
         sbatch.DrawCentered(Icon, bounds.Center, b.Width, b.Height, HUDKeyboard.COLOR_TEXT);
     }
     else
     {
         if (!string.IsNullOrEmpty(textBase))
         {
             FontRenderHelper.DrawTextCentered(sbatch, HUD.DefaultFont, TextSize, textBase, HUDKeyboard.COLOR_TEXT, bounds.Center);
         }
         if (!string.IsNullOrEmpty(textAlt))
         {
             FontRenderHelper.DrawTextTopRight(sbatch, HUD.DefaultFont, TextSizeAlt, textAlt, HUDKeyboard.COLOR_ALT, bounds.TopRight + new Vector2(-TextAltPadding, 0));
         }
     }
 }
Ejemplo n.º 10
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var icontex = Data.Icon();
            var iconscl = Data.IconScale;
            var iconcol = Data.IconColor();

            sbatch.DrawCentered(Textures.TexCircle, bounds.Center, bounds.Width, bounds.Height, IsPressed ? FlatColors.ButtonPressedHUD : FlatColors.ButtonHUD);

            sbatch.DrawCentered(Textures.TexCircleEmpty, bounds.Center, bounds.Width, bounds.Height, FlatColors.SeperatorHUD);

            if (icontex != null)
            {
                sbatch.DrawCentered(icontex, bounds.Center, bounds.Width * iconscl, bounds.Height * iconscl, iconcol);
            }

            FontRenderHelper.DrawTextCentered(
                sbatch,
                Textures.HUDFontBold,
                48,
                L10N.T(Data.Description),
                FlatColors.TextHUD,
                bounds.Center - new Vector2(0, bounds.Height / 2 + 32));

            var txt = Data.Text();
            var tcc = Data.TextColor();

            if (!string.IsNullOrWhiteSpace(txt))
            {
                FontRenderHelper.DrawTextCentered(
                    sbatch,
                    Textures.HUDFontBold,
                    64,
                    txt,
                    tcc,
                    bounds.Center);
            }
        }
Ejemplo n.º 11
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            float nepX = RootExpansionProgress;
            float lepX = 1 - RootExpansionProgress;

            float iep0 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[0]);
            float lep0 = 1 - ExpansionProgress[0];
            float nep0 = ExpansionProgress[0];

            float iep1 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[1]);
            float lep1 = 1 - ExpansionProgress[1];
            float nep1 = ExpansionProgress[1];

            float iep2 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[2]);
            float lep2 = 1 - ExpansionProgress[2];
            float nep2 = ExpansionProgress[2];

            float iep3 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[3]);
            float lep3 = 1 - ExpansionProgress[3];
            float nep3 = ExpansionProgress[3];

            #region Expander

            if (State[(int)FractionDifficulty.DIFF_0] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderNorth.AsTranslated(0, HEIGHT_EXTENDER * iep0).LimitSingleCoordSouth(Position.Y),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.COLOR_DIFFICULTY_0 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            if (State[(int)FractionDifficulty.DIFF_1] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderEast.AsTranslated(-HEIGHT_EXTENDER * iep1, 0).LimitSingleCoordWest(Position.X),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.COLOR_DIFFICULTY_1 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            if (State[(int)FractionDifficulty.DIFF_2] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderSouth.AsTranslated(0, -HEIGHT_EXTENDER * iep2).LimitSingleCoordNorth(Position.Y),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.COLOR_DIFFICULTY_2 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            if (State[(int)FractionDifficulty.DIFF_3] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderWest.AsTranslated(HEIGHT_EXTENDER * iep3, 0).LimitSingleCoordEast(Position.X),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.COLOR_DIFFICULTY_3 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            #endregion

            #region Icons

            if (State[(int)FractionDifficulty.DIFF_0] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine0,
                    rectExpanderNorth
                    .ToSquare(ICON_SIZE, FlatAlign9.NORTH)
                    .AsTranslated(0, +ICON_OFFSET)
                    .AsTranslated(0, HEIGHT_EXTENDER * iep0),
                    clickAreaD0.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            if (State[(int)FractionDifficulty.DIFF_1] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine1,
                    rectExpanderEast
                    .ToSquare(ICON_SIZE, FlatAlign9.EAST)
                    .AsTranslated(-ICON_OFFSET, 0)
                    .AsTranslated(-HEIGHT_EXTENDER * iep1, 0),
                    clickAreaD1.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            if (State[(int)FractionDifficulty.DIFF_2] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine2,
                    rectExpanderSouth
                    .ToSquare(ICON_SIZE, FlatAlign9.SOUTH)
                    .AsTranslated(0, -ICON_OFFSET)
                    .AsTranslated(0, -HEIGHT_EXTENDER * iep2),
                    clickAreaD2.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            if (State[(int)FractionDifficulty.DIFF_3] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine3,
                    rectExpanderWest
                    .ToSquare(ICON_SIZE, FlatAlign9.WEST)
                    .AsTranslated(+ICON_OFFSET, 0)
                    .AsTranslated(HEIGHT_EXTENDER * iep3, 0),
                    clickAreaD3.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            #endregion

            #region Ground

            if (NodeEnabled)
            {
                sbatch.DrawCentered(Textures.TexCircle, Position, DIAMETER, DIAMETER, FlatColors.Asbestos);
            }
            else
            {
                sbatch.DrawCentered(Textures.TexCircle, Position, DIAMETER, DIAMETER, FlatColors.Silver);
            }

            #endregion

            #region Segments

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.COLOR_DIFFICULTY_0.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_000 + FloatMath.TAU * nepX);

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.COLOR_DIFFICULTY_1.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_090 + FloatMath.TAU * nepX);

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.COLOR_DIFFICULTY_2.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_180 + FloatMath.TAU * nepX);

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.COLOR_DIFFICULTY_3.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_270 + FloatMath.TAU * nepX);

            #endregion

            #region Structure

            sbatch.DrawCentered(Textures.TexLevelNodeStructure, Position, DIAMETER, DIAMETER, FlatColors.MidnightBlue, FloatMath.TAU * nepX);

            #endregion

            #region Text

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, FONTSIZE, Blueprint.Name, ColorMath.Blend(FlatColors.Clouds, FlatColors.MidnightBlue, nepX), Position);

            #endregion
        }
Ejemplo n.º 12
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            if (_needsTabRecalc)
            {
                RecalcTabData();
            }

            sbatch.FillRectangle(bounds, Background);

            float rowHeight = FontSize + 2 * LineWidth;
            float py        = 0;

            // Header
            {
                sbatch.FillRectangle(new FRectangle(bounds.X, bounds.Y, bounds.Width - ScrollWidth, rowHeight), HeaderBackground);
                float x = 0;
                for (int i = 0; i < _columns.Count; i++)
                {
                    if (FloatMath.IsZero(_columns[i].RealWidth))
                    {
                        continue;
                    }

                    FontRenderHelper.DrawTextCentered(
                        sbatch,
                        Font,
                        FontSize,
                        _columns[i].Text,
                        HeaderForeground,
                        new FPoint(bounds.Left + x + _columns[i].RealWidth / 2f, bounds.Top + rowHeight / 2f));

                    x += _columns[i].RealWidth;
                }
                sbatch.DrawLine(bounds.Left, bounds.Top + rowHeight, bounds.Right - ScrollWidth, bounds.Top + rowHeight, LineColor, LineWidth);

                py += rowHeight;
            }

            // rows
            for (int di = (int)ScrollPosition; di < _data.Count; di++)
            {
                if (py + rowHeight > Height)
                {
                    break;
                }

                float x = 0;
                for (int ci = 0; ci < _columns.Count; ci++)
                {
                    if (FloatMath.IsZero(_columns[ci].RealWidth))
                    {
                        continue;
                    }

                    FontRenderHelper.DrawTextVerticallyCentered(
                        sbatch,
                        Font,
                        FontSize,
                        _data[di].Data[ci],
                        _data[di].ForegroundOverride ?? Foreground,
                        new FPoint(bounds.Left + x + LineWidth * 2, bounds.Top + py + rowHeight / 2f));

                    x += _columns[ci].RealWidth;
                }
                sbatch.DrawLine(bounds.Left, bounds.Top + py + rowHeight, bounds.Right - ScrollWidth, bounds.Top + py + rowHeight, LineColor, LineWidth);

                py += rowHeight;
            }

            // scroll
            {
                var colPerPage = (int)(Height / rowHeight) - 1;
                var perc       = FloatMath.Clamp(((int)ScrollPosition) / (1f * _data.Count - colPerPage), 0, 1);

                var pos = perc * (Height - ScrollHeight);

                sbatch.FillRectangle(new FRectangle(bounds.Right - ScrollWidth, bounds.Top + pos, ScrollWidth, ScrollHeight), ScrollThumbColor);
            }

            // Vert Lines
            {
                float x = 0;
                for (int i = 0; i < _columns.Count; i++)
                {
                    x += _columns[i].RealWidth;
                    sbatch.DrawLine(bounds.Left + x, bounds.Top, bounds.Left + x, bounds.Bottom, LineColor, LineWidth);
                }
            }

            sbatch.DrawRectangle(bounds, LineColor, LineWidth);
        }