private void ToggleIndex(int index) { if (listButtons[index] is UIToggleButton) { UIToggleButton toggleButton = (UIToggleButton)listButtons[index]; toggleButton.Toggle(); } }
public UIToggleButton AddToggleButton(String text, String desc) { if (listButtons.Count == 1) { SelectIndex(0); } UIToggleButton btn = new UIToggleButton(text, desc, 5, y_spacing * listButtons.Count); listButtons.Add(btn); return(btn); }
private void Initialize() { // Parents UIButton parentSpawnButton = _mainMenu1.AddButton("Spawn", "Spawning functions"); UIButton parentVehicleButton = _mainMenu1.AddButton("Vehicle", "Vehicle functions"); UIButton parentPedButton = _mainMenu1.AddButton("Ped", "Ped functions"); UIButton parentPlayerButton = _mainMenu1.AddButton("Player", "Player functions"); // Parents:Events parentSpawnButton.Click += ParentSpawnButtonOnClick; parentVehicleButton.Click += ParentVehicleButtonOnClick; parentPedButton.Click += ParentPedButtonOnClick; parentPlayerButton.Click += ParentPlayerButtonOnClick; // Spawning UIButton subSpawnVehicleButton = _subSpawn.AddButton("Spawn Vehicle", "Spawns a vehicle with a specified model"); UIButton subSpawnPedButton = _subSpawn.AddButton("Spawn Ped", "Spawns a ped with a specified model"); UIButton subSpawnObjectButton = _subSpawn.AddButton("Spawn Object", "Spawns an object with a specified model"); UIToggleButton subVehicleWarpTButton = _subSpawn.AddToggleButton("Warp into vehicle", "Whether to warp into a newly spawned vehicle"); UIButton subSpawnBackButton = _subSpawn.AddButton("Go Back", "Goes back to the main-menu"); // Spawning:Events subSpawnBackButton.Click += GoBackMainMenuOnClick; // Vehicle UIButton subVehicleModButton = _subVehicle.AddButton("Mod", "Mods the current vehicle"); UIButton subVehicleSettingsButton = _subVehicle.AddButton("Settings", "Settings of the current vehicle"); UIButton subVehicleBackButton = _subVehicle.AddButton("Go Back", "Goes back to the main-menu"); // Vehicle:Events subVehicleBackButton.Click += GoBackMainMenuOnClick; // Ped UIButton subPedButton = _subPed.AddButton("", ""); // Player UIButton subPlayerButton = _subPlayer.AddButton("", ""); }