Exemplo n.º 1
0
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }
            base.Draw();

            var res = UIMenu.GetScreenResolutionMantainRatio();

            var alpha      = Focused ? 120 : 30;
            var blackAlpha = Focused ? 200 : 100;
            var fullAlpha  = Focused ? 255 : 150;

            var submenuWidth = (BottomRight.X - TopLeft.X);
            var itemSize     = new Size(submenuWidth, 40);

            int i = 0;

            for (int c = _minItem; c < Math.Min(Items.Count, _maxItem); c++)
            {
                var hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)),
                                                      itemSize);

                var hasLeftBadge  = Items[c].LeftBadge != UIMenuItem.BadgeStyle.None;
                var hasRightBadge = Items[c].RightBadge != UIMenuItem.BadgeStyle.None;

                var hasBothBadges = hasRightBadge && hasLeftBadge;
                var hasAnyBadge   = hasRightBadge || hasLeftBadge;

                new UIResRectangle(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Color.White) : Focused && hovering ? Color.FromArgb(100, 50, 50, 50) : Color.FromArgb(blackAlpha, Color.Black)).Draw();
                new UIResText(Items[c].Text, SafeSize.AddPoints(new Point((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White)).Draw();

                if (hasLeftBadge && !hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw();
                }

                if (!hasLeftBadge && hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw();
                }

                if (hasLeftBadge && hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw();

                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(25, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw();
                }

                if (!string.IsNullOrEmpty(Items[c].RightLabel))
                {
                    new UIResText(Items[c].RightLabel,
                                  SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)),
                                  0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White),
                                  Font.ChaletLondon, UIResText.Alignment.Right).Draw();
                }

                if (Items[c] is UIMenuCheckboxItem)
                {
                    string textureName = "";
                    if (c == Index && Focused)
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tickb" : "shop_box_blankb";
                    }
                    else
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tick" : "shop_box_blank";
                    }
                    new Sprite("commonmenu", textureName, SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)), new Size(50, 50)).Draw();
                }

                if (Focused && hovering && Game.IsControlJustPressed(0, Control.CursorAccept))
                {
                    bool open = Index == c;
                    Index = (1000 - (1000 % Items.Count) + c) % Items.Count;
                    if (!open)
                    {
                        Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);
                    }
                    else
                    {
                        if (Items[Index] is UIMenuCheckboxItem)
                        {
                            Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);
                            ((UIMenuCheckboxItem)Items[Index]).Checked = !((UIMenuCheckboxItem)Items[Index]).Checked;
                            ((UIMenuCheckboxItem)Items[Index]).CheckboxEventTrigger();
                        }
                        else
                        {
                            Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);
                            Items[Index].ItemActivate(null);
                        }
                    }
                }

                i++;
            }
        }
Exemplo n.º 2
0
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }

            base.Draw();

            int blackAlpha = Focused ? 200 : 100;
            int fullAlpha  = Focused ? 255 : 150;

            int  subMenuWidth = (BottomRight.X - TopLeft.X);
            Size itemSize     = new Size(subMenuWidth, 40);

            int i = 0;

            for (int c = minItem; c < Math.Min(Items.Count, maxItem); c++)
            {
                //bool hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize);

                bool hasLeftBadge  = Items[c].LeftBadge != UIMenuItem.BadgeStyle.None;
                bool hasRightBadge = Items[c].RightBadge != UIMenuItem.BadgeStyle.None;

                bool hasBothBadges = hasRightBadge && hasLeftBadge;
                bool hasAnyBadge   = hasRightBadge || hasLeftBadge;

                ResRectangle.Draw(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Color.White) : /*Focused && hovering ? Color.FromArgb(100, 50, 50, 50) :*/ Color.FromArgb(blackAlpha, Color.Black));
                ResText.Draw(Items[c].Text, SafeSize.AddPoints(new Point((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White), Common.EFont.ChaletLondon, false);

                if (hasLeftBadge && !hasRightBadge)
                {
                    Sprite.Draw(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                                UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused)));
                }

                if (!hasLeftBadge && hasRightBadge)
                {
                    Sprite.Draw(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                                UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused)));
                }

                if (hasLeftBadge && hasRightBadge)
                {
                    Sprite.Draw(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                                UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused)));

                    Sprite.Draw(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                                UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(25, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused)));
                }

                if (!String.IsNullOrEmpty(Items[c].RightLabel))
                {
                    ResText.Draw(Items[c].RightLabel,
                                 SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)),
                                 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White),
                                 Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
                }

                if (Items[c] is UIMenuCheckboxItem)
                {
                    string textureName;
                    if (c == Index && Focused)
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tickb" : "shop_box_blankb";
                    }
                    else
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tick" : "shop_box_blank";
                    }
                    Sprite.Draw("commonmenu", textureName, SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)), new Size(50, 50), 0f, Color.White);
                }
                else if (Items[c] is UIMenuListItem)
                {
                    var convItem = (UIMenuListItem)Items[c];

                    var yoffset = 5;
                    var basePos =
                        SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));

                    var arrowLeft  = new Sprite("commonmenu", "arrowleft", basePos, new Size(30, 30));
                    var arrowRight = new Sprite("commonmenu", "arrowright", basePos, new Size(30, 30));
                    var itemText   = new ResText("", basePos, 0.35f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right);

                    string caption = (convItem.Collection == null ? convItem.IndexToItem(convItem.Index) : convItem.Collection[convItem.Index]).ToString();
                    int    offset  = StringMeasurer.MeasureString(caption);

                    var selected = c == Index && Focused;

                    itemText.Color = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    itemText.Caption = caption;

                    arrowLeft.Color  = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);
                    arrowRight.Color = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    arrowLeft.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60 - offset, yoffset + (itemSize.Height + 3) * i));
                    if (selected)
                    {
                        arrowLeft.Draw();
                        arrowRight.Draw();
                        itemText.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));
                    }
                    else
                    {
                        itemText.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 5, yoffset + (itemSize.Height + 3) * i));
                    }

                    itemText.Draw();
                }

                //if (Focused && hovering && (Common.IsDisabledControlJustPressed(0, GameControl.CursorAccept) || Game.IsControlJustPressed(0, GameControl.CursorAccept)))
                //{
                //    bool open = Index == c;
                //    Index = (1000 - (1000 % Items.Count) + c) % Items.Count;
                //    if (!open)
                //        Common.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //    else
                //    {
                //        if (Items[Index] is UIMenuCheckboxItem)
                //        {
                //            Common.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //            UIMenuCheckboxItem cb = (UIMenuCheckboxItem)Items[Index];
                //            cb.Checked = !cb.Checked;
                //            cb.CheckboxEventTrigger();
                //        }
                //        else
                //        {
                //            Common.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //            Items[Index].ItemActivate(null);
                //        }
                //    }
                //}

                i++;
            }
        }
Exemplo n.º 3
0
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }
            base.Draw();

            var res = ScreenTools.ResolutionMaintainRatio;

            var alpha      = Focused ? 120 : 30;
            var blackAlpha = Focused ? 200 : 100;
            var fullAlpha  = Focused ? 255 : 150;

            var submenuWidth = (BottomRight.X - TopLeft.X);
            var itemSize     = new SizeF(submenuWidth, 40);

            int i = 0;

            for (int c = _minItem; c < Math.Min(Items.Count, _maxItem); c++)
            {
                var hovering = ScreenTools.IsMouseInBounds(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)),
                                                           itemSize);

                var hasLeftBadge  = Items[c].LeftBadge != UIMenuItem.BadgeStyle.None;
                var hasRightBadge = Items[c].RightBadge != UIMenuItem.BadgeStyle.None;

                var hasBothBadges = hasRightBadge && hasLeftBadge;
                var hasAnyBadge   = hasRightBadge || hasLeftBadge;

                new UIResRectangle(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Colors.White) : Focused && hovering ? Color.FromArgb(100, 50, 50, 50) : Color.FromArgb(blackAlpha, Colors.Black)).Draw();
                new UIResText(Items[c].Text, SafeSize.AddPoints(new PointF((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White)).Draw();

                if (hasLeftBadge && !hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw();
                }

                if (!hasLeftBadge && hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw();
                }

                if (hasLeftBadge && hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw();

                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(25, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw();
                }

                if (!string.IsNullOrEmpty(Items[c].RightLabel))
                {
                    new UIResText(Items[c].RightLabel,
                                  SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)),
                                  0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White),
                                  Font.ChaletLondon, Alignment.Right).Draw();
                }

                if (Items[c] is UIMenuCheckboxItem)
                {
                    string textureName = "";
                    if (c == Index && Focused)
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tickb" : "shop_box_blankb";
                    }
                    else
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tick" : "shop_box_blank";
                    }
                    new Sprite("commonmenu", textureName, SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)), new SizeF(50, 50)).Draw();
                }
                else if (Items[c] is UIMenuListItem convItem)
                {
                    var yoffset = 5;
                    var basePos =
                        SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));

                    var arrowLeft  = new Sprite("commonmenu", "arrowleft", basePos, new SizeF(30, 30));
                    var arrowRight = new Sprite("commonmenu", "arrowright", basePos, new SizeF(30, 30));
                    var itemText   = new UIResText("", basePos, 0.35f, Colors.White, Font.ChaletLondon,
                                                   Alignment.Left)
                    {
                        TextAlignment = Alignment.Right
                    };

                    string caption = convItem.Items[convItem.Index].ToString();
                    float  offset  = ScreenTools.GetTextWidth(caption, itemText.Font, itemText.Scale);

                    var selected = c == Index && Focused;

                    itemText.Color = convItem.Enabled ? selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    itemText.Caption = caption;

                    arrowLeft.Color  = convItem.Enabled ? selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);
                    arrowRight.Color = convItem.Enabled ? selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    arrowLeft.Position =
                        SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60 - (int)offset, yoffset + (itemSize.Height + 3) * i));
                    if (selected)
                    {
                        arrowLeft.Draw();
                        arrowRight.Draw();
                        itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));
                    }
                    else
                    {
                        itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, yoffset + (itemSize.Height + 3) * i));
                    }

                    itemText.Draw();
                }

                if (Focused && hovering && Game.IsControlJustPressed(0, Control.CursorAccept))
                {
                    bool open = Index == c;
                    Index = (1000 - (1000 % Items.Count) + c) % Items.Count;
                    if (!open)
                    {
                        Game.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                    }
                    else
                    {
                        if (Items[Index] is UIMenuCheckboxItem)
                        {
                            Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                            ((UIMenuCheckboxItem)Items[Index]).Checked = !((UIMenuCheckboxItem)Items[Index]).Checked;
                            ((UIMenuCheckboxItem)Items[Index]).CheckboxEventTrigger();
                        }
                        else
                        {
                            Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                            Items[Index].ItemActivate(null);
                        }
                    }
                }

                i++;
            }
        }
Exemplo n.º 4
0
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }
            base.Draw();

            var alpha      = Focused ? 120 : 30;
            var blackAlpha = Focused ? 200 : 100;
            var fullAlpha  = Focused ? 250 : 150;

            var submenuWidth = (BottomRight.X - TopLeft.X);
            var itemSize     = new SizeF(submenuWidth, 40);

            int i = 0;

            for (int c = _minItem; c < Math.Min(Items.Count, _maxItem); c++)
            {
                var hovering = ScreenTools.IsMouseInBounds(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)),
                                                           itemSize);

                var hasLeftBadge  = Items[c].LeftBadge != UIMenuItem.BadgeStyle.None;
                var hasRightBadge = Items[c].RightBadge != UIMenuItem.BadgeStyle.None;

                var hasBothBadges = hasRightBadge && hasLeftBadge;
                var hasAnyBadge   = hasRightBadge || hasLeftBadge;



                new UIResRectangle(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Colors.White) : Focused && hovering ? Color.FromArgb(100, 50, 50, 50) : Color.FromArgb(blackAlpha, Colors.Black)).Draw();
                new UIResText(Items[c].Text, SafeSize.AddPoints(new PointF((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White)).Draw();

                if (hasLeftBadge && !hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw();
                }

                if (!hasLeftBadge && hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw();
                }

                if (hasLeftBadge && hasRightBadge)
                {
                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw();

                    new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge),
                               UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(25, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f,
                               UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw();
                }

                if (!string.IsNullOrEmpty(Items[c].RightLabel))
                {
                    new UIResText(Items[c].RightLabel,
                                  SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)),
                                  0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White),
                                  Font.ChaletLondon, Alignment.Right).Draw();
                }

                if (Items[c] is UIMenuCheckboxItem convItem)
                {
                    convItem.Selected = c == Index && Focused;
                    convItem._checkedSprite.Position    = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i));
                    convItem._checkedSprite.TextureName = convItem.Selected ? (convItem.Checked ? (convItem.Style == UIMenuCheckboxStyle.Tick ? "shop_box_tickb" : "shop_box_crossb") : "shop_box_blankb") : convItem.Checked ? (convItem.Style == UIMenuCheckboxStyle.Tick ? "shop_box_tick" : "shop_box_cross") : "shop_box_blank";
                    convItem._checkedSprite.Draw();
                }
                else if (Items[c] is UIMenuListItem listItem)
                {
                    var yoffset = 5;
                    var basePos =
                        SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));

                    listItem._arrowLeft.Position     = basePos;
                    listItem._arrowRight.Position    = basePos;
                    listItem._itemText.Position      = basePos;
                    listItem._itemText.Color         = Colors.White;
                    listItem._itemText.Font          = Font.ChaletLondon;
                    listItem._itemText.Alignment     = Alignment.Left;
                    listItem._itemText.TextAlignment = Alignment.Right;

                    string caption = listItem.Items[listItem.Index].ToString();
                    float  offset  = ScreenTools.GetTextWidth(caption, listItem._itemText.Font, listItem._itemText.Scale);

                    var selected = c == Index && Focused;
                    listItem.Selected = selected;

                    listItem._itemText.Color = listItem.Enabled ? listItem.Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    listItem._itemText.Caption = caption;

                    listItem._arrowLeft.Color  = listItem.Enabled ? listItem.Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);
                    listItem._arrowRight.Color = listItem.Enabled ? listItem.Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    listItem._arrowLeft.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60 - (int)offset, yoffset + (itemSize.Height + 3) * i));
                    if (listItem.Selected)
                    {
                        listItem._arrowLeft.Draw();
                        listItem._arrowRight.Draw();
                        listItem._itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));
                    }
                    else
                    {
                        listItem._itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, yoffset + (itemSize.Height + 3) * i));
                    }
                    listItem._itemText.Draw();
                }
                else if (Items[c] is UIMenuSliderItem sliderItem)
                {
                    var yoffset = 15;
                    var basePos = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 210, yoffset + (itemSize.Height + 3) * i));
                    sliderItem._rectangleBackground.Position = basePos;
                    sliderItem._rectangleBackground.Size     = new SizeF(200f, 10);

                    sliderItem._rectangleSlider.Position = basePos;
                    sliderItem._rectangleSlider.Size     = new SizeF(100f, 10);

                    sliderItem._rectangleDivider.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 110, (yoffset - 5) + (itemSize.Height + 3) * i));
                    sliderItem._rectangleDivider.Size     = new SizeF(2, 20);
                    if (sliderItem.Divider)
                    {
                        sliderItem._rectangleDivider.Color = Colors.WhiteSmoke;
                    }
                    sliderItem.Selected = c == Index && Focused;

                    sliderItem._rectangleSlider.Position = new PointF(basePos.X + (sliderItem._value / (float)sliderItem._max * 100f), sliderItem._rectangleSlider.Position.Y);
                    sliderItem._rectangleBackground.Draw();
                    sliderItem._rectangleSlider.Draw();
                    if (sliderItem.Divider)
                    {
                        sliderItem._rectangleDivider.Draw();
                    }
                }
                else if (Items[c] is UIMenuSliderProgressItem sliderProgressItem)
                {
                    var yoffset = 15;
                    var basePos = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 210, yoffset + (itemSize.Height + 3) * i));
                    sliderProgressItem._rectangleBackground.Position = basePos;
                    sliderProgressItem._rectangleBackground.Size     = new SizeF(200, 10);

                    sliderProgressItem._rectangleSlider.Position = basePos;

                    sliderProgressItem._rectangleDivider.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 100, (yoffset - 5) + (itemSize.Height + 3f) * i));
                    sliderProgressItem._rectangleDivider.Size     = new SizeF(2, 20);

                    if (sliderProgressItem.Divider)
                    {
                        sliderProgressItem._rectangleDivider.Color = Colors.WhiteSmoke;
                    }
                    sliderProgressItem.Selected = c == Index && Focused;

                    sliderProgressItem._rectangleBackground.Draw();
                    sliderProgressItem._rectangleSlider.Draw();
                    sliderProgressItem._rectangleDivider.Draw();

                    if (ScreenTools.IsMouseInBounds(new PointF(sliderProgressItem._rectangleBackground.Position.X, sliderProgressItem._rectangleBackground.Position.Y - 5), new SizeF(200f, sliderProgressItem._rectangleBackground.Size.Height)))
                    {
                        if (API.IsDisabledControlPressed(0, 24))
                        {
                            if (!sliderProgressItem.Pressed)
                            {
                                sliderProgressItem.Pressed  = true;
                                sliderProgressItem.Audio.Id = API.GetSoundId();
                                API.PlaySoundFrontend(sliderProgressItem.Audio.Id, sliderProgressItem.Audio.Slider, sliderProgressItem.Audio.Library, true);
                            }
                            float CursorX  = API.GetDisabledControlNormal(0, 239) * Resolution.Width;
                            var   Progress = CursorX - sliderProgressItem._rectangleSlider.Position.X;
                            sliderProgressItem.Value = (int)Math.Round(sliderProgressItem._max * ((Progress >= 0f && Progress <= 200f) ? Progress : (Progress < 0) ? 0 : 200f) / 200f);
                            sliderProgressItem.SliderProgressChanged(sliderProgressItem.Value);
                        }
                        else
                        {
                            API.StopSound(sliderProgressItem.Audio.Id);
                            API.ReleaseSoundId(sliderProgressItem.Audio.Id);
                            sliderProgressItem.Pressed = false;
                        }
                    }
                    else
                    {
                        API.StopSound(sliderProgressItem.Audio.Id);
                        API.ReleaseSoundId(sliderProgressItem.Audio.Id);
                        sliderProgressItem.Pressed = false;
                    }
                }

                if (Focused && hovering && Game.IsControlJustPressed(0, Control.CursorAccept))
                {
                    bool open = Index == c;
                    Index = (1000 - (1000 % Items.Count) + c) % Items.Count;
                    if (!open)
                    {
                        Game.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                    }
                    else
                    {
                        if (Items[Index] is UIMenuCheckboxItem)
                        {
                            Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                            ((UIMenuCheckboxItem)Items[Index]).Checked = !((UIMenuCheckboxItem)Items[Index]).Checked;
                            ((UIMenuCheckboxItem)Items[Index]).CheckboxEventTrigger();
                        }
                        else
                        {
                            Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                            Items[Index].ItemActivate(null);
                        }
                    }
                }
                i++;
            }
        }