Пример #1
0
 /// <summary>
 ///     Gets the width of the MenuKeyBind
 /// </summary>
 /// <returns>The <see cref="int" /></returns>
 public override int Width()
 {
     return(BlueUtilities.CalcWidthItem(this.Component)
            + (int)
            (MenuSettings.ContainerHeight + BlueUtilities.CalcWidthText("[" + this.Component.Key + "]")
             + MenuSettings.ContainerTextOffset));
 }
Пример #2
0
        /// <summary>
        ///     Draws a MenuKeyBind
        /// </summary>
        public override void Draw()
        {
            var centerY =
                (int)
                BlueUtilities.GetContainerRectangle(this.Component)
                .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter)
                .Y;

            MenuSettings.Font.DrawText(
                MenuManager.Instance.Sprite,
                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
                     - BlueUtilities.CalcWidthText(keyString) - MenuSettings.ContainerTextOffset),
                    centerY,
                    BlueMenuSettings.KeyBindColor);
            }

            Line.Width = MenuSettings.ContainerHeight - 7;
            Line.Begin();
            Line.Draw(
                new[]
            {
                new Vector2(
                    (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - 1)
                    + MenuSettings.ContainerHeight / 2f,
                    this.Component.Position.Y + 1 + 3),
                new Vector2(
                    (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - 1)
                    + MenuSettings.ContainerHeight / 2f,
                    this.Component.Position.Y + MenuSettings.ContainerHeight - 3)
            },
                this.Component.Active ? new ColorBGRA(0, 186, 255, 255) : new ColorBGRA(36, 36, 36, 255));
            Line.End();

            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;

            MenuSettings.Font.DrawText(
                MenuManager.Instance.Sprite,
                this.Component.Active ? "On" : "Off",
                centerX,
                centerY,
                this.Component.Active ? new ColorBGRA(0, 27, 41, 255) : MenuSettings.TextColor);
        }