private void MainMenu_OnItemLeftRight(UIMenu sender, UIMenuItem selectedItem, int index, UIMenu.Direction direction) { // Check which item is selected. if (selectedItem == itemIntegerControl) { // ControlIntValue is an easy way to let a menu item control // a specific int with one line of code. // In this example, we will control the var "testInt" with // the "itemIntegerControl" menu item. // The params that follow are explained with intellisense. mainMenu.ControlIntValue(ref testInt, itemIntegerControl, direction, 1, 5, true, 0, 100); UI.ShowSubtitle("You pressed " + (direction == UIMenu.Direction.Left ? "Left" : "Right") + " while highlighting Integer Item!"); } else if (selectedItem == itemFloatControl) { // ControlFloatValue is an easy way to let a menu item control // a specific float with one line of code. // In this example, we will control the var "testFloat" with // the "itemFloatControl" menu item. // The params that follow are explained with intellisense. mainMenu.ControlFloatValue(ref testFloat, itemFloatControl, direction, 0.5f, 1f, 2, true, 0f, 10f); UI.ShowSubtitle("You pressed " + (direction == UIMenu.Direction.Left ? "Left" : "Right") + " while highlighting Float Item!"); } else if (selectedItem == itemEnumControl) { // ControlEnumValue is an easy way to let a menu item control // a specific enum with one line of code. // In this example, we will control the var "testEnum" with // the "itemEnumControl" menu item. mainMenu.ControlEnumValue(ref testEnum, itemEnumControl, direction); UI.ShowSubtitle("You pressed " + (direction == UIMenu.Direction.Left ? "Left" : "Right") + " while highlighting Enum Item!"); } else if (selectedItem == itemListControl) { // An item of type UIMenuListItem is automatically controlled by the menu. UI.ShowSubtitle("\"" + itemListControl.CurrentListItem.ToString() + "\" is selected."); } else if (selectedItem == itemListControlAdvanced) { // UIMenuListItem.CurrentListItem will return the actual selected object // in the list. You must cast it to the actual object type. Ex: // Person p = (Person)list.CurrentListItem; UI.ShowSubtitle("\"" + itemListControlAdvanced.CurrentListItem.ToString() + "\" is selected."); } }
private void MainMenu_OnItemLeftRight(UIMenu sender, UIMenuItem selectedItem, int index, UIMenu.Direction direction) { // Check which item is selected. if (selectedItem == item_Quantity) { // ControlIntValue is an easy way to let a menu item control // a specific int with one line of code. // In this example, we will control the var "testInt" with // the "itemIntegerControl" menu item. // The params that follow are explained with intellisense. purchase_Main_Menu.ControlIntValue(ref qty, item_Quantity, direction, 1, 5, true, 0, 20); GTA.UI.Screen.ShowSubtitle("You pressed " + (direction == UIMenu.Direction.Left ? "Left" : "Right") + " while highlighting Integer Item!"); } }