Ejemplo n.º 1
0
        private void RefreshMenu()
        {
            myMenu.Clear();
            UIMenuColoredItem item = new UIMenuColoredItem("Save Current Vehicle", Color.FromArgb(80, 80, 50, 80), Color.FromArgb(180, 205, 41, 255));

            item.Description = $"Press Enter to save, {VehicleList.DeleteCarKeyCode} to repair.";
            item.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            myMenu.AddItem(item);
            foreach (var i in VehicleList.Vehicles)
            {
                item             = new UIMenuColoredItem(i.VehicleHash.ToString() + " (" + i.PrimaryColor.ToString() + ")", Color.FromArgb(30, 50, 50, 50), Color.FromArgb(180, 234, 237, 64));
                item.Description = $"Press Enter to spawn, {VehicleList.DeleteCarKeyCode} to delete.";
                item.SetLeftBadge(UIMenuItem.BadgeStyle.Car);
                myMenu.AddItem(item);
            }
            myMenu.RefreshIndex();
        }
        public UIMenuColoredItem AddColoredItem(UIMenu menu, string title, string desc, Color color1, Color color2, string rightLabel = "", UIMenuItem.BadgeStyle badge = UIMenuItem.BadgeStyle.None, bool isBadgeLeft = true)
        {
            var menuItem = new UIMenuColoredItem(title, desc, color1, color2);

            if (rightLabel != "")
            {
                menuItem.SetRightLabel(rightLabel);
            }

            if (isBadgeLeft)
            {
                menuItem.SetLeftBadge(badge);
            }
            else
            {
                menuItem.SetRightBadge(badge);
            }

            menu.AddItem(menuItem);
            return(menuItem);
        }