示例#1
0
        private List <MenuItem> GetCustomColourMenu(string actionPrefix)
        {
            var list = new List <MenuItem>()
            {
                new MenuItem()
                {
                    text   = "Custom (HTML #RRGGBB or R,G,B)",
                    action = $"{actionPrefix} input"
                },
            };

            foreach (var kv in CustomColourList.Colours)
            {
                string colourName = kv.Key;
                string colourHex  = kv.Value;
                var    colour     = CustomColourList.GetByName(colourName);
                var    rgb        = $"{colour.R},{colour.G},{colour.B}";

                list.Add(new MenuItem()
                {
                    text   = Trainer.AddSpacesToSentence(colourName),
                    action = $"{actionPrefix} {rgb}",
                    image  = MakeDummyImageUrl(colourHex),
                });
            }

            return(list);
        }
示例#2
0
        private List <MenuItem> GetPlatesMenu()
        {
            var list = new List <MenuItem>();

            var plateStyles = new List <string>();

            foreach (var style in Enum.GetValues(typeof(LicensePlateStyle)))
            {
                var name = Trainer.AddSpacesToSentence(style.ToString());

                list.Add(new MenuItem()
                {
                    text   = $"Style: {name}",
                    action = $"vehplatestyle {(int)style}",
                });
            }

            list.Sort((x, y) => x.text.CompareTo(y.text));

            list.Insert(0, new MenuItem()
            {
                text   = "Change Text",
                action = "vehplatetext"
            });

            return(list);
        }
示例#3
0
        private Dictionary <string, List <MenuItem> > AddSpawnByTypeMenus(Dictionary <string, List <MenuItem> > menus)
        {
            var typeMenuList = new List <MenuItem>();

            foreach (VehicleClass vehicleClass in Enum.GetValues(typeof(VehicleClass)))
            {
                string submenuName = $"vehicles.spawn.type.{vehicleClass.ToString().ToLower()}";

                typeMenuList.Add(new MenuItem()
                {
                    text = Trainer.AddSpacesToSentence(vehicleClass.ToString()),
                    sub  = submenuName,
                });

                menus[submenuName] = GetVehicleSpawnMenu(VehicleList.GetByVehicleClass(vehicleClass));

                if (menus[submenuName].Count == 0)
                {
                    menus[submenuName].Add(new MenuItem()
                    {
                        text = "No vehicles of this type added yet",
                    });
                }
            }

            typeMenuList = typeMenuList.OrderBy(x => x.text).ToList();

            menus["vehicles.spawn.type"] = typeMenuList;

            return(menus);
        }
示例#4
0
        private string CleanColourName(string colourName)
        {
            colourName = colourName.Replace("Util", "Utility");
            colourName = colourName.Replace("Metallic", "");
            colourName = Trainer.AddSpacesToSentence(colourName);

            return(colourName);
        }
示例#5
0
        public List <MenuItem> GetDefaultRadioMenu()
        {
            var list                  = new List <MenuItem>();
            var defaultText           = "No Default";
            int currentDefaultStation = -1;

            if (Config.ContainsKey("DefaultRadioStation") && int.TryParse(Config["DefaultRadioStation"], out int result))
            {
                currentDefaultStation = result;
            }

            if (currentDefaultStation == -1)
            {
                defaultText += " (Current)";
            }

            list.Add(new MenuItem()
            {
                text   = defaultText,
                action = "defaultradio -1",
            });

            foreach (var station in Enum.GetValues(typeof(RadioStation)))
            {
                string menuText     = Trainer.AddSpacesToSentence(station.ToString());
                int    stationIndex = (int)station;

                if (currentDefaultStation == stationIndex)
                {
                    menuText += " (Current)";
                }

                list.Add(new MenuItem()
                {
                    text   = menuText,
                    action = $"defaultradio {stationIndex}",
                });
            }

            // Temporary workaround for missing stations
            list.Add(new MenuItem()
            {
                text   = "Blonded FM" + (currentDefaultStation == 100 ? " (Current)" : ""),
                action = "defaultradio 100",
            });

            list.Add(new MenuItem()
            {
                text   = "Los Santos Underground" + (currentDefaultStation == 101 ? " (Current)" : ""),
                action = "defaultradio 101",
            });

            return(list);
        }