Пример #1
0
        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);

                GTA.UI.Screen.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);

                GTA.UI.Screen.ShowSubtitle("You pressed " + (direction == UIMenu.Direction.Left ? "Left" : "Right") + " while highlighting Float Item!");
            }
            else if (selectedItem == Job_Type)
            {
                // 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 Selection_Manager.instance.job_Selection_enum, Job_Type, direction);
                GTA.UI.Screen.ShowSubtitle("Job type selected : " + Selection_Manager.instance.job_Selection_enum);
                //GTA.UI.Screen.ShowSubtitle("You pressed " + (direction == UIMenu.Direction.Left ? "Left" : "Right") + " while highlighting Enum Item!");
            }
            else if (selectedItem == jobTypeList)
            {
                // An item of type UIMenuListItem is automatically controlled by the menu.
                //GTA.UI.Notification.Show();

                //jobTypeList.IndexFromItem(jobTypeList.CurrentListItem).ToString();
                //YourEnum foo = (YourEnum)yourInt;
                Selection_Manager.instance.job_Selection_enum = (Selection_Manager.Job_Selection)jobTypeList.IndexFromItem(jobTypeList.CurrentListItem) + 1;
                Selection_Manager.instance.SelectedJob        = jobTypeList.CurrentListItem.ToString();
                GTA.UI.Screen.ShowSubtitle("\"" + jobTypeList.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;
                GTA.UI.Screen.ShowSubtitle("\"" + itemListControlAdvanced.CurrentListItem.ToString() + "\" is selected.");
            }
        }