Ejemplo n.º 1
0
        public float DrawShopIcon(PointF position, bool seleceted, ShopIcon shopIcon, SizeF size)
        {
            if (shopIcon == ShopIcon.None)
            {
                return(0f);
            }

            GetShopIconFromEnum(shopIcon, out var iconNormal, out var iconHover);
            NativeFunctions.DrawSprite("commonmenu", seleceted ? iconHover : iconNormal, position + new SizeF(15, 18),
                                       size);
            return(34f);
        }
        public override void DrawTextValue(string text, PointF position, bool selected)
        {
            NativeFunctions.DrawText(text, position - new SizeF(selected && Enabled ? 28 : 14, 40), NativeMenu.DescriptionTextScale, !Enabled ? Color.Gray : selected ? Color.FromArgb(255, 45, 45, 45) : Color.White, 2, GTA.Font.ChaletLondon, false, false);

            if (!selected || !Enabled)
            {
                return;
            }

            NativeFunctions.DrawSprite("commonmenu", "arrowright", position - new SizeF(18, 21), new SizeF(20, 20), 0f, Color.Black);

            NativeFunctions.DrawSprite("commonmenu", "arrowleft", position - new SizeF(18 + NativeFunctions.MeasureStringWidth(text, "jamyfafi", GTA.Font.ChaletLondon, NativeMenu.DescriptionTextScale) + 16, 21), new SizeF(20, 20), 0f, Color.Black);
        }
Ejemplo n.º 3
0
        public void Draw(PointF position, SizeF size, bool selected, bool hover, bool hover2, ref bool overridenCursor)
        {
            if (selected)
            {
                foreach (var button in CustomButtons)
                {
                    Game.DisableControlThisFrame(2, button.Key);
                    if (Game.IsDisabledControlJustPressed(2, button.Key))
                    {
                        OnButtonDown(this, new NativeMenuItemButtonEventArgs(this, button.Key));
                    }
                    else if (Game.IsDisabledControlJustReleased(2, button.Key))
                    {
                        OnButtonUp(this, new NativeMenuItemButtonEventArgs(this, button.Key));
                    }
                    else if (Game.IsDisabledControlPressed(2, button.Key))
                    {
                        OnButtonHeld(this, new NativeMenuItemButtonEventArgs(this, button.Key));
                    }
                }
            }

            var pos = new PointF(position.X + NativeMenu.DescriptionXOffset,
                                 position.Y + NativeMenu.DescriptionYOffset);

            if (selected || hover)
            {
                NativeFunctions.DrawSprite("commonmenu", "gradient_nav",
                                           new PointF(size.Width / 2 + position.X, size.Height / 2 + position.Y), size, 0,
                                           selected ? Color.White : NativeMenu.HighlightColor());

                if (selected && hover2 && InteractionCursor != CursorSprite.None)
                {
                    Function.Call(Hash._0x8DB8CFFD58B62552, (int)InteractionCursor);  // SET_CURSOR_SPRITE
                    overridenCursor = true;
                }
            }

            var offset = DrawShopIcon(pos, selected, ShopIcon, new SizeF(50, 50));

            NativeFunctions.DrawText(Text, pos + new SizeF(offset, 0f), NativeMenu.DescriptionTextScale,
                                     Enabled ? selected ? Color.FromArgb(255, 45, 45, 45) : Color.White : Color.Gray, 1, Font.ChaletLondon,
                                     false, false);
            DrawValue(position + size, selected);
        }