/// <summary> /// Gets the width of the MenuKeyBind /// </summary> /// <returns>The <see cref="int" /></returns> public override int Width() { return(ColoredUtilities.CalcWidthItem(this.Component) + (int) (MenuSettings.ContainerHeight + ColoredUtilities.CalcWidthText("[" + this.Component.Key + "]") + MenuSettings.ContainerTextOffset)); }
/// <summary> /// Calculates the Width of an AMenuComponent /// </summary> /// <returns> /// The width. /// </returns> public override int Width() { return ((int) (ColoredUtilities.MeasureString(MultiLanguage.Translation(this.Component.DisplayName) + " »").Width + (MenuSettings.ContainerTextOffset * 2) + MenuSettings.ContainerTextMarkWidth)); }
/// <summary> /// Draws a <see cref="MenuButton" /> /// </summary> public override void Draw() { var rectangleName = ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, MultiLanguage.Translation(this.Component.DisplayName), CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); var buttonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, this.Component.ButtonText, 0).Width; Utils.DrawBoxRounded( this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, this.Component.Position.Y + (MenuSettings.ContainerHeight / 8f), (this.Component.Position.X + this.Component.MenuWidth - 2) - (this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2), MenuSettings.ContainerHeight - 5, 8, true, this.Component.Hovering ? MenuSettings.ContainerSelectedColor : this.buttonColor, this.Component.Hovering ? MenuSettings.ContainerSelectedColor : this.buttonColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.ButtonText), (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), (int)rectangleName.Y, MenuSettings.TextColor); }
/// <summary> /// Draw a <see cref="MenuSeparator" /> /// </summary> public override void Draw() { var centerY = ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText( null, ColoredMenuSettings.FontCaption, MultiLanguage.Translation(this.Component.DisplayName), CenteredFlags.VerticalCenter | CenteredFlags.HorizontalCenter); ColoredMenuSettings.FontCaption.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)centerY.X, (int)centerY.Y, ColoredMenuSettings.TextCaptionColor); Line.Width = 2; Line.Begin(); Line.Draw( new[] { new Vector2( this.Component.Position.X + Offset, ColoredUtilities.GetContainerRectangle(this.Component).Center.Y), new Vector2( Math.Max(this.Component.Position.X + Offset, centerY.X - 5), ColoredUtilities.GetContainerRectangle(this.Component).Center.Y) }, MenuSettings.ContainerSelectedColor); var newX = ColoredMenuSettings.FontCaption.MeasureText( MenuManager.Instance.Sprite, this.Component.DisplayName.ToUpper(), 0).Width; Line.Draw( new[] { new Vector2(centerY.X + newX + 5, ColoredUtilities.GetContainerRectangle(this.Component).Center.Y), new Vector2( Math.Max( centerY.X + newX + 5, ColoredUtilities.GetContainerRectangle(this.Component).Right - Offset), ColoredUtilities.GetContainerRectangle(this.Component).Center.Y) }, MenuSettings.ContainerSelectedColor); Line.End(); }
/// <summary> /// Gets the boundaries /// </summary> /// <param name="component">The <see cref="MenuSlider" /></param> /// <returns>The <see cref="Rectangle" /></returns> public Rectangle Bounding(MenuSlider component) { return(ColoredUtilities.GetContainerRectangle(component)); }
/// <summary> /// Gets the additional boundaries. /// </summary> /// <param name="component">The <see cref="MenuSlider" /></param> /// <returns>The <see cref="Rectangle" /></returns> public Rectangle AdditionalBoundries(MenuSlider component) { return(ColoredUtilities.GetContainerRectangle(component)); }
/// <summary> /// Calculates the width of this component /// </summary> /// <returns> /// The width. /// </returns> public override int Width() { return(ColoredUtilities.CalcWidthItem(this.Component) + 100); }
/// <summary> /// Draws a <see cref="MenuSlider" /> /// </summary> public override void Draw() { var position = this.Component.Position; var centeredY = (int) ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText( null, MenuSettings.Font, MultiLanguage.Translation(this.Component.DisplayName), CenteredFlags.VerticalCenter) .Y; var percent = (this.Component.Value - this.Component.MinValue) / (float)(this.Component.MaxValue - this.Component.MinValue); var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2)); var maxX = position.X + Offset + ((this.Component.MenuWidth - Offset * 2)); MenuManager.Instance.DrawDelayed( delegate { Utils.DrawCircleFilled( x, position.Y + MenuSettings.ContainerHeight / 1.5f + 3, 4, 0, Utils.CircleType.Full, true, 32, MenuSettings.ContainerSelectedColor); }); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)(position.X + MenuSettings.ContainerTextOffset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( null, this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, this.Component.Value.ToString(CultureInfo.InvariantCulture), (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); Line.Width = 2; Line.Begin(); Line.Draw( new[] { new Vector2(position.X + Offset, position.Y + MenuSettings.ContainerHeight / 1.5f + 3), new Vector2(maxX, position.Y + MenuSettings.ContainerHeight / 1.5f + 3) }, new ColorBGRA(193, 189, 188, 255)); Line.End(); Line.Width = 2; Line.Begin(); Line.Draw( new[] { new Vector2(position.X + Offset, position.Y + MenuSettings.ContainerHeight / 1.5f + 3), new Vector2(x, position.Y + MenuSettings.ContainerHeight / 1.5f + 3) }, MenuSettings.ContainerSelectedColor); Line.End(); }
/// <summary> /// Draws a MenuKeyBind /// </summary> public override void Draw() { var centerY = (int) ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.Interacting ? "Press a key" : this.Component.DisplayName), (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); if (!this.Component.Interacting) { var keyString = "[" + this.Component.Key + "]"; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, keyString, (int) (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - ColoredUtilities.CalcWidthText(keyString) - MenuSettings.ContainerTextOffset), centerY, MenuSettings.ContainerSelectedColor); } var centerX = (int) new Rectangle( (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), (int)this.Component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, this.Component.Active ? "On" : "Off", CenteredFlags.HorizontalCenter).X - 5; //Left Utils.DrawCircle( centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); //Right Utils.DrawCircle( centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); //Top Line.Width = 1; Line.Begin(); Line.Draw( new[] { new Vector2(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f - 8), new Vector2(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f - 8) }, MenuSettings.TextColor); Line.End(); //Bot Line.Width = 1; Line.Begin(); Line.Draw( new[] { new Vector2(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f + 7), new Vector2(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f + 7) }, MenuSettings.TextColor); Line.End(); //FullCircle Utils.DrawCircleFilled( this.Component.Active ? centerX + 14 : centerX + 1, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, this.Component.Active ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); }
/// <summary> /// Gets the width of a <see cref="MenuColor" /> /// </summary> /// <returns>The <see cref="int" /></returns> public override int Width() { return(ColoredUtilities.CalcWidthItem(this.Component) + MenuSettings.ContainerHeight); }
/// <summary> /// Draws a MenuColor /// </summary> public override void Draw() { var rectangleName = ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); Line.Width = MenuSettings.ContainerHeight - 7; Line.Begin(); Line.Draw( new[] { new Vector2( this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, this.Component.Position.Y + 1 + 3), new Vector2( this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, this.Component.Position.Y + Line.Width + 3) }, this.Component.Color); Line.End(); if (this.Component.HoveringPreview) { Line.Begin(); Line.Draw( new[] { new Vector2( this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, this.Component.Position.Y + 1 + 3), new Vector2( this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, this.Component.Position.Y + Line.Width + 3) }, MenuSettings.HoverColor); Line.End(); } if (this.Component.Active) { MenuManager.Instance.DrawDelayed( delegate { Line.Width = this.ColorPickerBoundaries().Width; Line.Begin(); Line.Draw( new[] { new Vector2(this.ColorPickerBoundaries().X + 165, this.ColorPickerBoundaries().Y), new Vector2( this.ColorPickerBoundaries().X + 165, this.ColorPickerBoundaries().Y + this.ColorPickerBoundaries().Height) }, MenuSettings.RootContainerColor); Line.End(); this.ColorBox.DrawControl( new Vector2(this.ColorBoxBoundaries().X, this.ColorBoxBoundaries().Y)); this.VerticalColorSlider.DrawControl( new Vector2( this.VerticalColorSliderBoundaries().X, this.VerticalColorSliderBoundaries().Y)); this.VerticalAlphaSlider.DrawControl( new Vector2( this.VerticalAlphaSliderBoundaries().X, this.VerticalAlphaSliderBoundaries().Y)); Utils.DrawBoxFilled( this.PreviewBoundaries().X, this.PreviewBoundaries().Y, this.PreviewBoundaries().Width, this.PreviewBoundaries().Height, Color.Black); Utils.DrawBoxFilled( this.PreviewBoundaries().X, this.PreviewBoundaries().Y, this.PreviewBoundaries().Width, this.PreviewBoundaries().Height, this.ColorBox.Rgb.ToSharpDxColor()); var applyButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Apply", 0).Width; var cancelButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Cancel", 0).Width; Line.Width = this.ApplyButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { new Vector2(this.ApplyButtonBoundaries().X + 25, this.ApplyButtonBoundaries().Y), new Vector2( this.ApplyButtonBoundaries().X + 25, this.ApplyButtonBoundaries().Y + this.ApplyButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Apply", this.ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, (int) this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Apply", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); Line.Width = this.CancelButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { new Vector2(this.CancelButtonBoundaries().X + 25, this.CancelButtonBoundaries().Y), new Vector2( this.CancelButtonBoundaries().X + 25, this.CancelButtonBoundaries().Y + this.CancelButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Cancel", this.CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, (int) this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Cancel", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); }); } }
/// <summary> /// Draws an Menu /// </summary> public override void Draw() { var position = this.Component.Position; if (this.hovering && !this.Component.Toggled && this.Component.Components.Count > 0) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); Line.Draw( new[] { new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), new Vector2( position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); Line.End(); } var centerY = (int) ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, MultiLanguage.Translation(this.Component.DisplayName), CenteredFlags.VerticalCenter) .Y; if (this.Component.Toggled) { MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)(position.X + MenuSettings.ContainerTextOffset), centerY, new ColorBGRA(237, 245, 254, 255)); } else { MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)(position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); } MenuManager.Instance.DrawDelayed( delegate { var symbolCenterY = (int) ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText( null, ColoredMenuSettings.FontMenuSymbol, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; Utils.DrawCircleFilled( (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - MenuSettings.ContainerTextMarkOffset) + 4, symbolCenterY + 11, 6, 0, Utils.CircleType.Full, true, 16, new ColorBGRA(252, 248, 245, 255)); ColoredMenuSettings.FontMenuSymbol.DrawText( MenuManager.Instance.Sprite, "›", (int) (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - MenuSettings.ContainerTextMarkOffset) + 1, symbolCenterY, this.Component.Components.Count > 0 ? ColoredMenuSettings.TextCaptionColor : MenuSettings.ContainerSeparatorColor); }); if (this.Component.Toggled) { Line.Width = this.Component.MenuWidth - 3; Line.Begin(); Line.Draw( new[] { new Vector2(position.X + this.Component.MenuWidth / 2f - 1, position.Y + 1), new Vector2( position.X + this.Component.MenuWidth / 2f - 1, position.Y + MenuSettings.ContainerHeight - 1) }, MenuSettings.ContainerSelectedColor); Line.End(); float height = MenuSettings.ContainerHeight * this.Component.Components.Count; var width = MenuSettings.ContainerWidth; if (this.Component.Components.Count > 0) { width = this.Component.Components.First().Value.MenuWidth; } Utils.DrawBoxRounded( position.X + this.Component.MenuWidth, position.Y, width, height, 4, true, MenuSettings.RootContainerColor, new ColorBGRA(55, 76, 95, 255)); for (var i = 0; i < this.Component.Components.Count; ++i) { var childComponent = this.Component.Components.Values.ToList()[i]; if (childComponent != null) { var childPos = new Vector2( position.X + this.Component.MenuWidth, position.Y + i * MenuSettings.ContainerHeight); childComponent.OnDraw(childPos); } } } if (this.hasDragged && !MenuCustomizer.Instance.LockPosition.Value) { var sprite = MenuManager.Instance.Sprite; var oldMatrix = sprite.Transform; var y = (int)(MenuSettings.Position.Y + (MenuManager.Instance.Menus.Count * MenuSettings.ContainerHeight)); var dragTexture = ColoredTextures.Instance[ColoredTexture.Dragging]; var x = MenuSettings.Position.X - dragTexture.Width; sprite.Transform = Matrix.Translation(x - 1, y + 2, 0); sprite.Draw(dragTexture.Texture, Color.White); sprite.Transform = oldMatrix; Line.Width = 1f; Line.Begin(); Line.Draw( new[] { new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), }, MenuSettings.ContainerSeparatorColor); Line.End(); } }
/// <summary> /// Draws a <see cref="MenuSlider" /> /// </summary> public override void Draw() { //Slider var position = this.Component.Position; var centeredY = (int) ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, MultiLanguage.Translation(this.Component.DisplayName), CenteredFlags.VerticalCenter) .Y; var percent = (this.Component.SValue - this.Component.MinValue) / (float)(this.Component.MaxValue - this.Component.MinValue); var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); var maxX = position.X + Offset + ((this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); MenuManager.Instance.DrawDelayed( delegate { Utils.DrawCircleFilled( x, position.Y + MenuSettings.ContainerHeight / 1.5f + 3, 4, 0, Utils.CircleType.Full, true, 32, MenuSettings.ContainerSelectedColor); }); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)(position.X + MenuSettings.ContainerTextOffset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( null, this.Component.SValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.SValue.ToString(CultureInfo.InvariantCulture)), (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset - MenuSettings.ContainerHeight), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); Line.Width = 2; Line.Begin(); Line.Draw( new[] { new Vector2(position.X + Offset, position.Y + MenuSettings.ContainerHeight / 1.5f + 3), new Vector2(maxX, position.Y + MenuSettings.ContainerHeight / 1.5f + 3) }, new ColorBGRA(193, 189, 188, 255)); Line.End(); Line.Width = 2; Line.Begin(); Line.Draw( new[] { new Vector2(position.X + Offset, position.Y + MenuSettings.ContainerHeight / 1.5f + 3), new Vector2(x, position.Y + MenuSettings.ContainerHeight / 1.5f + 3) }, MenuSettings.ContainerSelectedColor); Line.End(); //On / Off Button var centerX = (int) new Rectangle( (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), (int)this.Component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, this.Component.BValue ? "On" : "Off", CenteredFlags.HorizontalCenter).X - 5; //Left Utils.DrawCircle( centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); //Right Utils.DrawCircle( centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); //Top Line.Width = 1; Line.Begin(); Line.Draw( new[] { new Vector2(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f - 8), new Vector2(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f - 8) }, MenuSettings.TextColor); Line.End(); //Bot Line.Width = 1; Line.Begin(); Line.Draw( new[] { new Vector2(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f + 7), new Vector2(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f + 7) }, MenuSettings.TextColor); Line.End(); //FullCircle Utils.DrawCircleFilled( this.Component.BValue ? centerX + 14 : centerX + 1, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, this.Component.BValue ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); }
/// <summary> /// Gets the width of the <see cref="MenuButton" /> /// </summary> /// <returns> /// The <see cref="int" />. /// </returns> public override int Width() { return(ColoredUtilities.CalcWidthItem(this.Component) + (2 * TextGap) + MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, this.Component.ButtonText, 0).Width); }
/// <summary> /// Draw a <see cref="MenuList" /> /// </summary> public override void Draw() { var dropdownMenuWidth = this.dropDownButtonWidth + (2 * TextSpacing) + this.Component.MaxStringWidth; var position = this.Component.Position; var rectangleName = ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText( null, MenuSettings.Font, MultiLanguage.Translation(this.Component.DisplayName), CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.DisplayName), (int)(position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "\u23EC", (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(this.Component.SelectedValueAsObject.ToString()), (int)position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - this.Component.MaxStringWidth, (int)rectangleName.Y, this.Component.Active ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); if (this.Component.Active) { var valueStrings = this.Component.ValuesAsStrings; var dropdownMenuHeight = valueStrings.Length * MenuSettings.ContainerHeight; MenuManager.Instance.DrawDelayed( delegate { Utils.DrawBoxRounded( position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + MenuSettings.ContainerHeight, dropdownMenuWidth, dropdownMenuHeight, 4, true, MenuSettings.RootContainerColor, new ColorBGRA(55, 76, 95, 255)); var x = (int) (position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - this.Component.MaxStringWidth); var y = (int)rectangleName.Y; for (var i = 0; i < valueStrings.Length; i++) { if (i == this.Component.HoveringIndex) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); Line.Draw( new[] { new Vector2( position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f), new Vector2( position.X + this.Component.MenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); Line.End(); } if (i != 0) { Line.Width = 1f; Line.Begin(); Line.Draw( new[] { new Vector2( position.X + this.Component.MenuWidth - dropdownMenuWidth + 10, position.Y + (MenuSettings.ContainerHeight * (i + 1))), new Vector2( position.X + this.Component.MenuWidth - 10, position.Y + (MenuSettings.ContainerHeight * (i + 1))) }, MenuSettings.ContainerSeparatorColor); Line.End(); } y += MenuSettings.ContainerHeight; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, MultiLanguage.Translation(valueStrings[i]), x, y, MenuSettings.TextColor); if (this.Component.Index == i) { var checkmarkWidth = MenuSettings.Font.MeasureText(null, "\u2713", 0).Width; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "\u2713", (int)(position.X + this.Component.MenuWidth - checkmarkWidth - TextSpacing), y, new ColorBGRA(1, 165, 226, 255)); } } }); } }
/// <summary> /// Gets the width of the MenuList /// </summary> /// <returns>The <see cref="int" /></returns> public override int Width() { return(ColoredUtilities.CalcWidthItem(this.Component) + this.Component.MaxStringWidth + (2 * TextSpacing) + this.dropDownButtonWidth); }
/// <summary> /// Gets the <c>keybind</c> boundaries /// </summary> /// <param name="component">The <see cref="MenuKeyBind" /></param> /// <returns>The <see cref="Rectangle" /></returns> public Rectangle KeyBindBoundaries(MenuKeyBind component) { return(ColoredUtilities.GetContainerRectangle(component)); }