/// <summary>
        /// Update the items of the main menu
        /// </summary>
        private void UpdateEditorMenu()
        {
            if (editorMenu == null)
            {
                return;
            }

            editorMenu.ClearMenuItems();

            if (!CurrentPresetIsValid)
            {
                return;
            }

            AddDynamicFloatList(editorMenu, "Front Track Width", -currentPreset.DefaultOffsetX[0], -currentPreset.OffsetX[0], frontMaxOffset, FrontOffsetID);
            AddDynamicFloatList(editorMenu, "Rear Track Width", -currentPreset.DefaultOffsetX[currentPreset.FrontWheelsCount], -currentPreset.OffsetX[currentPreset.FrontWheelsCount], rearMaxOffset, RearOffsetID);
            AddDynamicFloatList(editorMenu, "Front Camber", currentPreset.DefaultRotationY[0], currentPreset.RotationY[0], frontMaxCamber, FrontRotationID);
            AddDynamicFloatList(editorMenu, "Rear Camber", currentPreset.DefaultRotationY[currentPreset.FrontWheelsCount], currentPreset.RotationY[currentPreset.FrontWheelsCount], rearMaxCamber, RearRotationID);
            // Steering lock, custom min max
            var callbackSL = FloatChangeCallback("Steering Lock", currentPreset.SteeringLock, steeringLockMinVal, steeringLockMaxVal, 1f);
            var newitemSL  = new MenuDynamicListItem("Steering Lock", currentPreset.SteeringLock.ToString("F3"), callbackSL)
            {
                ItemData = SteeringLockID
            };

            editorMenu.AddMenuItem(newitemSL);
            // Suspension height, custom min max
            var callbackSH = FloatChangeCallback("Suspension Height", currentPreset.SuspensionHeight, suspensionHeightMinVal, suspensionHeightMaxVal, 0.005f);
            var newitemSH  = new MenuDynamicListItem("Suspension Height", currentPreset.SuspensionHeight.ToString("F3"), callbackSH)
            {
                ItemData = SuspensionHeightID
            };

            editorMenu.AddMenuItem(newitemSH);

            editorMenu.AddMenuItem(new MenuItem("Reset", "Restores the default values")
            {
                ItemData = ResetID
            });
            editorMenu.AddMenuItem(new MenuItem("Save preset", "Saves preset for this vehicle")
            {
                ItemData = SaveID
            });
            editorMenu.AddMenuItem(new MenuItem("Load preset", "Loads preset for this vehicle")
            {
                ItemData = LoadID
            });
        }
        private MenuDynamicListItem[] AddDynamicVector3List(Menu menu, FieldInfo <Vector3> fieldInfo)
        {
            string fieldName = fieldInfo.Name;

            if (!CurrentPreset.Fields.TryGetValue(fieldName, out dynamic tmp))
            {
                return(null);
            }

            var value = (Vector3)tmp;

            string fieldDescription = fieldInfo.Description;

            string fieldNameX = $"{fieldName}_x";
            string fieldNameY = $"{fieldName}_y";
            string fieldNameZ = $"{fieldName}_z";

            var newitemX = new MenuDynamicListItem(fieldNameX, value.X.ToString("F3"), DynamicListChangeCallback, fieldDescription)
            {
                ItemData = fieldInfo
            };

            menu.AddMenuItem(newitemX);

            var newitemY = new MenuDynamicListItem(fieldNameY, value.Y.ToString("F3"), DynamicListChangeCallback, fieldDescription)
            {
                ItemData = fieldInfo
            };

            menu.AddMenuItem(newitemY);

            var newitemZ = new MenuDynamicListItem(fieldNameZ, value.Z.ToString("F3"), DynamicListChangeCallback, fieldDescription)
            {
                ItemData = fieldInfo
            };

            menu.AddMenuItem(newitemZ);

            return(new MenuDynamicListItem[3] {
                newitemX, newitemY, newitemZ
            });
        }
        private MenuDynamicListItem AddDynamicIntList(Menu menu, FieldInfo <int> fieldInfo)
        {
            string fieldName   = fieldInfo.Name;
            string description = fieldInfo.Description;

            if (!CurrentPreset.Fields.TryGetValue(fieldName, out dynamic tmp))
            {
                return(null);
            }

            var value   = (int)tmp;
            var newitem = new MenuDynamicListItem(fieldName, value.ToString(), DynamicListChangeCallback, description)
            {
                ItemData = fieldInfo
            };

            menu.AddMenuItem(newitem);

            return(newitem);
        }
        /// <summary>
        /// Invoked when the value of a dynamic list item from the main editor menu is changed
        /// </summary>
        /// <param name="menu"></param>
        /// <param name="dynamicListItem"></param>
        /// <param name="oldValue"></param>
        /// <param name="newValue"></param>
        private void EditorMenu_OnDynamicListItemCurrentItemChange(Menu menu, MenuDynamicListItem dynamicListItem, string oldValue, string newValue)
        {
            // If the sender isn't the main editor menu...
            if (menu != EditorMenu)
            {
                return;
            }

            // If item data is not the expected one...
            if (!(dynamicListItem.ItemData is BaseFieldInfo fieldInfo))
            {
                return;
            }

            // Get field name which is controlled by this dynamic list item
            string fieldName = fieldInfo.Name;

            // Notify the value is changed so the preset can update...
            MenuPresetValueChanged?.Invoke(fieldName, newValue, dynamicListItem.Text);
        }
        /// <summary>
        /// The method that defines how a dynamic list item changes its value when you press left/right arrow
        /// </summary>
        /// <param name="item"></param>
        /// <param name="left"></param>
        /// <returns></returns>
        private string DynamicListChangeCallback(MenuDynamicListItem item, bool left)
        {
            var currentItem = item.CurrentItem;

            if (!(item.ItemData is BaseFieldInfo fieldInfo))
            {
                return(currentItem);
            }

            var itemText  = item.Text;
            var fieldName = fieldInfo.Name;
            var fieldType = fieldInfo.Type;

            if (fieldType == FieldType.IntType)
            {
                var value = int.Parse(currentItem);
                var min   = (fieldInfo as FieldInfo <int>).Min;
                var max   = (fieldInfo as FieldInfo <int>).Max;

                if (left)
                {
                    var newvalue = value - 1;
                    if (newvalue < min)
                    {
                        Screen.ShowNotification($"{ScriptName}: Min value allowed for ~b~{fieldName}~w~ is {min}");
                    }
                    else
                    {
                        value = newvalue;
                    }
                }
                else
                {
                    var newvalue = value + 1;
                    if (newvalue > max)
                    {
                        Screen.ShowNotification($"{ScriptName}: Max value allowed for ~b~{fieldName}~w~ is {max}");
                    }
                    else
                    {
                        value = newvalue;
                    }
                }
                return(value.ToString());
            }
            else if (fieldType == FieldType.FloatType)
            {
                var value = float.Parse(currentItem);
                var min   = (fieldInfo as FieldInfo <float>).Min;
                var max   = (fieldInfo as FieldInfo <float>).Max;

                if (left)
                {
                    var newvalue = value - FloatStep;
                    if (newvalue < min)
                    {
                        Screen.ShowNotification($"{ScriptName}: Min value allowed for ~b~{fieldName}~w~ is {min}");
                    }
                    else
                    {
                        value = newvalue;
                    }
                }
                else
                {
                    var newvalue = value + FloatStep;
                    if (newvalue > max)
                    {
                        Screen.ShowNotification($"{ScriptName}: Max value allowed for ~b~{fieldName}~w~ is {max}");
                    }
                    else
                    {
                        value = newvalue;
                    }
                }
                return(value.ToString("F3"));
            }
            else if (fieldType == FieldType.Vector3Type)
            {
                var value = float.Parse(currentItem);
                var min   = (fieldInfo as FieldInfo <Vector3>).Min;
                var max   = (fieldInfo as FieldInfo <Vector3>).Max;

                var minValueX = min.X;
                var minValueY = min.Y;
                var minValueZ = min.Z;
                var maxValueX = max.X;
                var maxValueY = max.Y;
                var maxValueZ = max.Z;

                if (itemText.EndsWith("_x"))
                {
                    if (left)
                    {
                        var newvalue = value - FloatStep;
                        if (newvalue < minValueX)
                        {
                            Screen.ShowNotification($"{ScriptName}: Min value allowed for ~b~{itemText}~w~ is {minValueX}");
                        }
                        else
                        {
                            value = newvalue;
                        }
                    }
                    else
                    {
                        var newvalue = value + FloatStep;
                        if (newvalue > maxValueX)
                        {
                            Screen.ShowNotification($"{ScriptName}: Max value allowed for ~b~{itemText}~w~ is {maxValueX}");
                        }
                        else
                        {
                            value = newvalue;
                        }
                    }
                    return(value.ToString("F3"));
                }
                else if (itemText.EndsWith("_y"))
                {
                    if (left)
                    {
                        var newvalue = value - FloatStep;
                        if (newvalue < minValueY)
                        {
                            Screen.ShowNotification($"{ScriptName}: Min value allowed for ~b~{itemText}~w~ is {minValueY}");
                        }
                        else
                        {
                            value = newvalue;
                        }
                    }
                    else
                    {
                        var newvalue = value + FloatStep;
                        if (newvalue > maxValueY)
                        {
                            Screen.ShowNotification($"{ScriptName}: Max value allowed for ~b~{itemText}~w~ is {maxValueY}");
                        }
                        else
                        {
                            value = newvalue;
                        }
                    }
                    return(value.ToString("F3"));
                }
                else if (itemText.EndsWith("_z"))
                {
                    if (left)
                    {
                        var newvalue = value - FloatStep;
                        if (newvalue < minValueZ)
                        {
                            Screen.ShowNotification($"{ScriptName}: Min value allowed for ~b~{itemText}~w~ is {minValueZ}");
                        }
                        else
                        {
                            value = newvalue;
                        }
                    }
                    else
                    {
                        var newvalue = value + FloatStep;
                        if (newvalue > maxValueZ)
                        {
                            Screen.ShowNotification($"{ScriptName}: Max value allowed for ~b~{itemText}~w~ is {maxValueZ}");
                        }
                        else
                        {
                            value = newvalue;
                        }
                    }
                    return(value.ToString("F3"));
                }
            }

            return(currentItem);
        }
        /// <summary>
        /// Invoked when a <see cref="MenuDynamicListItem"/> from the main editor menu is selected
        /// </summary>
        /// <param name="menu"></param>
        /// <param name="dynamicListItem"></param>
        /// <param name="currentItem"></param>
        private async void EditorMenu_OnDynamicListItemSelect(Menu menu, MenuDynamicListItem dynamicListItem, string currentItem)
        {
            // If the item doesn't control any preset field...
            if (!(dynamicListItem.ItemData is BaseFieldInfo fieldInfo))
            {
                return;
            }

            //var currentItem = dynamicListItem.CurrentItem;
            var    itemText  = dynamicListItem.Text;
            string fieldName = fieldInfo.Name;
            var    fieldType = fieldInfo.Type;

            // Get the user input value
            string text = await GetOnScreenString(currentItem);

            // Check if the value can be accepted
            if (fieldType == FieldType.FloatType)
            {
                var min = (fieldInfo as FieldInfo <float>).Min;
                var max = (fieldInfo as FieldInfo <float>).Max;

                if (float.TryParse(text, out float newvalue))
                {
                    if (newvalue >= min && newvalue <= max)
                    {
                        dynamicListItem.CurrentItem = newvalue.ToString();
                        // Notify the value is changed so the preset can update...
                        MenuPresetValueChanged?.Invoke(fieldName, newvalue.ToString("F3"), itemText);
                    }
                    else
                    {
                        Screen.ShowNotification($"{ScriptName}: Value out of allowed limits for ~b~{fieldName}~w~, Min:{min}, Max:{max}");
                    }
                }
                else
                {
                    Screen.ShowNotification($"{ScriptName}: Invalid value for ~b~{fieldName}~w~");
                }
            }
            else if (fieldType == FieldType.IntType)
            {
                var min = (fieldInfo as FieldInfo <int>).Min;
                var max = (fieldInfo as FieldInfo <int>).Max;

                if (int.TryParse(text, out int newvalue))
                {
                    if (newvalue >= min && newvalue <= max)
                    {
                        dynamicListItem.CurrentItem = newvalue.ToString();
                        // Notify the value is changed so the preset can update...
                        MenuPresetValueChanged?.Invoke(fieldName, newvalue.ToString(), itemText);
                    }
                    else
                    {
                        Screen.ShowNotification($"{ScriptName}: Value out of allowed limits for ~b~{fieldName}~w~, Min:{min}, Max:{max}");
                    }
                }
                else
                {
                    Screen.ShowNotification($"{ScriptName}: Invalid value for ~b~{fieldName}~w~");
                }
            }
            else if (fieldType == FieldType.Vector3Type)
            {
                var min = (fieldInfo as FieldInfo <Vector3>).Min;
                var max = (fieldInfo as FieldInfo <Vector3>).Max;

                var minValueX = min.X;
                var minValueY = min.Y;
                var minValueZ = min.Z;
                var maxValueX = max.X;
                var maxValueY = max.Y;
                var maxValueZ = max.Z;

                if (itemText.EndsWith("_x"))
                {
                    if (float.TryParse(text, out float newvalue))
                    {
                        if (newvalue >= minValueX && newvalue <= maxValueX)
                        {
                            dynamicListItem.CurrentItem = newvalue.ToString("F3");
                            // Notify the value is changed so the preset can update...
                            MenuPresetValueChanged?.Invoke(fieldName, newvalue.ToString("F3"), itemText);
                        }
                        else
                        {
                            Screen.ShowNotification($"{ScriptName}: Value out of allowed limits for ~b~{itemText}~w~, Min:{minValueX}, Max:{maxValueX}");
                        }
                    }
                    else
                    {
                        Screen.ShowNotification($"{ScriptName}: Invalid value for ~b~{itemText}~w~");
                    }
                }
                else if (itemText.EndsWith("_y"))
                {
                    if (float.TryParse(text, out float newvalue))
                    {
                        if (newvalue >= minValueY && newvalue <= maxValueY)
                        {
                            dynamicListItem.CurrentItem = newvalue.ToString("F3");
                            // Notify the value is changed so the preset can update...
                            MenuPresetValueChanged?.Invoke(fieldName, newvalue.ToString("F3"), itemText);
                        }
                        else
                        {
                            Screen.ShowNotification($"{ScriptName}: Value out of allowed limits for ~b~{itemText}~w~, Min:{minValueY}, Max:{maxValueY}");
                        }
                    }
                    else
                    {
                        Screen.ShowNotification($"{ScriptName}: Invalid value for ~b~{itemText}~w~");
                    }
                }
                else if (itemText.EndsWith("_z"))
                {
                    if (float.TryParse(text, out float newvalue))
                    {
                        if (newvalue >= minValueZ && newvalue <= maxValueZ)
                        {
                            dynamicListItem.CurrentItem = newvalue.ToString("F3");
                            // Notify the value is changed so the preset can update...
                            MenuPresetValueChanged?.Invoke(fieldName, newvalue.ToString("F3"), itemText);
                        }
                        else
                        {
                            Screen.ShowNotification($"{ScriptName}: Value out of allowed limits for ~b~{itemText}~w~, Min:{minValueZ}, Max:{maxValueZ}");
                        }
                    }
                    else
                    {
                        Screen.ShowNotification($"{ScriptName}: Invalid value for ~b~{itemText}~w~");
                    }
                }
            }
        }
Exemple #7
0
        public ExampleMenu()
        {
            // Setting the menu alignment to be right aligned. This can be changed at any time and it'll update instantly.
            // To test this, checkout one of the checkbox items in this example menu. Clicking it will toggle the menu alignment.
            MenuController.MenuAlignment = MenuController.MenuAlignmentOption.Right;

            MenuController.MenuToggleKey = Control.InteractionMenu;

            // Creating the first menu.
            Menu menu = new Menu("Main Menu", "Subtitle");

            MenuController.AddMenu(menu);

            // Adding a new button by directly creating one inline. You could also just store it and then add it but we don't need to do that in this example.
            menu.AddMenuItem(new MenuItem("Normal Button", "This is a simple button with a simple description. Scroll down for more button types!"));


            // Creating 3 sliders, showing off the 3 possible variations and custom colors.
            MenuSliderItem slider  = new MenuSliderItem("Slider", 0, 10, 5, false);
            MenuSliderItem slider2 = new MenuSliderItem("Slider + Bar", 0, 10, 5, true)
            {
                BarColor        = Color.FromArgb(255, 73, 233, 111),
                BackgroundColor = Color.FromArgb(255, 25, 100, 43)
            };
            MenuSliderItem slider3 = new MenuSliderItem("Slider + Bar + Icons", "The icons are currently male/female because that's probably the most common use. But any icon can be used!", 0, 10, 5, true)
            {
                BarColor        = Color.FromArgb(255, 255, 0, 0),
                BackgroundColor = Color.FromArgb(255, 100, 0, 0),
                SliderLeftIcon  = MenuItem.Icon.MALE,
                SliderRightIcon = MenuItem.Icon.FEMALE
            };

            // adding the sliders to the menu.
            menu.AddMenuItem(slider);
            menu.AddMenuItem(slider2);
            menu.AddMenuItem(slider3);

            // Creating 3 checkboxs, 2 different styles and one has a locked icon and it's 'not enabled' (not enabled meaning you can't toggle it).
            MenuCheckboxItem box = new MenuCheckboxItem("Checkbox - Style 1 (click me!)", "This checkbox can toggle the menu position! Try it out.", !menu.LeftAligned)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Tick
            };

            MenuCheckboxItem box2 = new MenuCheckboxItem("Checkbox - Style 2", "This checkbox does nothing right now.", true)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Cross
            };

            MenuCheckboxItem box3 = new MenuCheckboxItem("Checkbox (unchecked + locked)", "Make this menu right aligned. If you set this to false, then the menu will move to the left.", false)
            {
                Style    = MenuCheckboxItem.CheckboxStyle.Cross,
                Enabled  = false,
                LeftIcon = MenuItem.Icon.LOCK
            };

            // Adding the checkboxes to the menu.
            menu.AddMenuItem(box);
            menu.AddMenuItem(box2);
            menu.AddMenuItem(box3);

            // Dynamic list item
            string ChangeCallback(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    return((int.Parse(item.CurrentItem) - 1).ToString());
                }
                return((int.Parse(item.CurrentItem) + 1).ToString());
            }

            MenuDynamicListItem dynList = new MenuDynamicListItem("Dynamic list item.", "0", new MenuDynamicListItem.ChangeItemCallback(ChangeCallback), "Description for this dynamic item. Pressing left will make the value smaller, pressing right will make the value bigger.");

            menu.AddMenuItem(dynList);

            // List items (first the 3 special variants, then a normal one)
            List <string> colorList = new List <string>();

            for (var i = 0; i < 64; i++)
            {
                colorList.Add($"Color #{i}");
            }
            MenuListItem hairColors = new MenuListItem("Hair Color", colorList, 0, "Hair color pallete.")
            {
                ShowColorPanel = true
            };

            // Also special
            List <string> makeupColorList = new List <string>();

            for (var i = 0; i < 64; i++)
            {
                makeupColorList.Add($"Color #{i}");
            }
            MenuListItem makeupColors = new MenuListItem("Makeup Color", makeupColorList, 0, "Makeup color pallete.")
            {
                ShowColorPanel      = true,
                ColorPanelColorType = MenuListItem.ColorPanelType.Makeup
            };

            // Also special
            List <string> opacityList = new List <string>();

            for (var i = 0; i < 11; i++)
            {
                opacityList.Add($"Opacity {i * 10}%");
            }
            MenuListItem opacity = new MenuListItem("Opacity Panel", opacityList, 0, "Set an opacity for something.")
            {
                ShowOpacityPanel = true
            };

            // Normal
            List <string> normalList = new List <string>()
            {
                "Item #1", "Item #2", "Item #3"
            };
            MenuListItem normalListItem = new MenuListItem("Normal List Item", normalList, 0, "And another simple description for yet another simple (list) item. Nothing special about this one.");

            // Adding the lists to the menu.
            menu.AddMenuItem(hairColors);
            menu.AddMenuItem(makeupColors);
            menu.AddMenuItem(opacity);
            menu.AddMenuItem(normalListItem);

            // Creating a submenu, adding it to the menus list, and creating and binding a button for it.
            Menu submenu = new Menu("Submenu", "Secondary Menu");

            MenuController.AddSubmenu(menu, submenu);

            MenuItem menuButton = new MenuItem("Submenu", "This button is bound to a submenu. Clicking it will take you to the submenu.")
            {
                Label = "→→→"
            };

            menu.AddMenuItem(menuButton);
            MenuController.BindMenuItem(menu, submenu, menuButton);

            // Adding items with sprites left & right to the submenu.
            for (var i = 0; i < Enum.GetValues(typeof(MenuItem.Icon)).Length; i++)
            {
                var tmpItem = new MenuItem($"Icon.{Enum.GetName(typeof(MenuItem.Icon), ((MenuItem.Icon)i))}", "This menu item has a left and right sprite. Press ~r~HOME~s~ to toggle the 'enabled' state on these items.")
                {
                    Label     = $"(#{i})",
                    LeftIcon  = (MenuItem.Icon)i,
                    RightIcon = (MenuItem.Icon)i
                };

                //var tmpItem2 = new MenuItem($"Icon.{Enum.GetName(typeof(MenuItem.Icon), ((MenuItem.Icon)i))}", "This menu item has a left and right sprite, and it's ~h~disabled~h~.");
                //tmpItem2.LeftIcon = (MenuItem.Icon)i;
                //tmpItem2.RightIcon = (MenuItem.Icon)i;
                //tmpItem2.Enabled = false;

                submenu.AddMenuItem(tmpItem);
                //submenu.AddMenuItem(tmpItem2);
            }
            submenu.ButtonPressHandlers.Add(new Menu.ButtonPressHandler(Control.FrontendSocialClubSecondary, Menu.ControlPressCheckType.JUST_RELEASED, new Action <Menu, Control>((m, c) =>
            {
                m.GetMenuItems().ForEach(a => a.Enabled = !a.Enabled);
            }), true));

            // Instructional buttons setup for the second (submenu) menu.
            submenu.InstructionalButtons.Add(Control.CharacterWheel, "Right?!");
            submenu.InstructionalButtons.Add(Control.CreatorLS, "Buttons");
            submenu.InstructionalButtons.Add(Control.CursorScrollDown, "Cool");
            submenu.InstructionalButtons.Add(Control.CreatorDelete, "Out!");
            submenu.InstructionalButtons.Add(Control.Cover, "This");
            submenu.InstructionalButtons.Add(Control.Context, "Check");

            // Create a third menu without a banner.
            Menu menu3 = new Menu(null, "Only a subtitle, no banner.");

            // you can use AddSubmenu or AddMenu, both will work but if you want to link this menu from another menu,
            // you should use AddSubmenu.
            MenuController.AddSubmenu(menu, menu3);
            MenuItem thirdSubmenuBtn = new MenuItem("Another submenu", "This is just a submenu without a banner. No big deal.")
            {
                Label = "→→→"
            };

            menu.AddMenuItem(thirdSubmenuBtn);
            MenuController.BindMenuItem(menu, menu3, thirdSubmenuBtn);
            menu3.AddMenuItem(new MenuItem("Nothing here!"));
            menu3.AddMenuItem(new MenuItem("Nothing here!"));
            menu3.AddMenuItem(new MenuItem("Nothing here!"));
            menu3.AddMenuItem(new MenuItem("Nothing here!"));


            /*
             ########################################################
             #                   Event handlers
             ########################################################
             */


            menu.OnCheckboxChange += (_menu, _item, _index, _checked) =>
            {
                // Code in here gets executed whenever a checkbox is toggled.
                Debug.WriteLine($"OnCheckboxChange: [{_menu}, {_item}, {_index}, {_checked}]");

                // If the align-menu checkbox is toggled, toggle the menu alignment.
                if (_item == box)
                {
                    if (_checked)
                    {
                        MenuController.MenuAlignment = MenuController.MenuAlignmentOption.Right;
                    }
                    else
                    {
                        MenuController.MenuAlignment = MenuController.MenuAlignmentOption.Left;
                    }
                }
            };

            menu.OnItemSelect += (_menu, _item, _index) =>
            {
                // Code in here would get executed whenever an item is pressed.
                Debug.WriteLine($"OnItemSelect: [{_menu}, {_item}, {_index}]");
            };

            menu.OnIndexChange += (_menu, _oldItem, _newItem, _oldIndex, _newIndex) =>
            {
                // Code in here would get executed whenever the up or down key is pressed and the index of the menu is changed.
                Debug.WriteLine($"OnIndexChange: [{_menu}, {_oldItem}, {_newItem}, {_oldIndex}, {_newIndex}]");
            };

            menu.OnListIndexChange += (_menu, _listItem, _oldIndex, _newIndex, _itemIndex) =>
            {
                // Code in here would get executed whenever the selected value of a list item changes (when left/right key is pressed).
                Debug.WriteLine($"OnListIndexChange: [{_menu}, {_listItem}, {_oldIndex}, {_newIndex}, {_itemIndex}]");
            };

            menu.OnListItemSelect += (_menu, _listItem, _listIndex, _itemIndex) =>
            {
                // Code in here would get executed whenever a list item is pressed.
                Debug.WriteLine($"OnListItemSelect: [{_menu}, {_listItem}, {_listIndex}, {_itemIndex}]");
            };

            menu.OnSliderPositionChange += (_menu, _sliderItem, _oldPosition, _newPosition, _itemIndex) =>
            {
                // Code in here would get executed whenever the position of a slider is changed (when left/right key is pressed).
                Debug.WriteLine($"OnSliderPositionChange: [{_menu}, {_sliderItem}, {_oldPosition}, {_newPosition}, {_itemIndex}]");
            };

            menu.OnSliderItemSelect += (_menu, _sliderItem, _sliderPosition, _itemIndex) =>
            {
                // Code in here would get executed whenever a slider item is pressed.
                Debug.WriteLine($"OnSliderItemSelect: [{_menu}, {_sliderItem}, {_sliderPosition}, {_itemIndex}]");
            };

            menu.OnMenuClose += (_menu) =>
            {
                // Code in here gets triggered whenever the menu is closed.
                Debug.WriteLine($"OnMenuClose: [{_menu}]");
            };

            menu.OnMenuOpen += (_menu) =>
            {
                // Code in here gets triggered whenever the menu is opened.
                Debug.WriteLine($"OnMenuOpen: [{_menu}]");
            };

            menu.OnDynamicListItemCurrentItemChange += (_menu, _dynamicListItem, _oldCurrentItem, _newCurrentItem) =>
            {
                // Code in here would get executed whenever the value of the current item of a dynamic list item changes.
                Debug.WriteLine($"OnDynamicListItemCurrentItemChange: [{_menu}, {_dynamicListItem}, {_oldCurrentItem}, {_newCurrentItem}]");
            };

            menu.OnDynamicListItemSelect += (_menu, _dynamicListItem, _currentItem) =>
            {
                // Code in here would get executed whenever a dynamic list item is pressed.
                Debug.WriteLine($"OnDynamicListItemSelect: [{_menu}, {_dynamicListItem}, {_currentItem}]");
            };
        }
Exemple #8
0
        private void CreateMenu()
        {
            Neons = new Menu($"{Dictionaries.LangMain[3]}", $"{Dictionaries.LangMain[4]}");


            MenuCheckboxItem NeonsRainbow = new MenuCheckboxItem($"{Dictionaries.LangNeon[0]}", $"{Dictionaries.LangNeon[1]}", NeonsRainbowVar1)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Tick
            };

            Neons.AddMenuItem(NeonsRainbow);

            MenuCheckboxItem NeonsRainbow2 = new MenuCheckboxItem($"{Dictionaries.LangNeon[2]}", $"{Dictionaries.LangNeon[3]}", NeonsRainbowVar2)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Tick
            };

            Neons.AddMenuItem(NeonsRainbow2);

            // AwaitDelay Dynamic List
            string AwaitDelayDyn(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = AwaitDelayVar - 1;
                    if (newvalue < 0)
                    {
                        newvalue = AwaitDelayVar = 300;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Rate~w~ is 0");
                        }
                    }
                    else
                    {
                        AwaitDelayVar = newvalue;
                    }
                }
                else
                {
                    var newvalue = AwaitDelayVar + 1;
                    AwaitDelayVar = newvalue;
                }
                return(AwaitDelayVar.ToString());
            }

            MenuDynamicListItem AwaitDelayList = new MenuDynamicListItem($"{Dictionaries.LangNeon[4]}", "300", AwaitDelayDyn, $"{Dictionaries.LangNeon[5]}");

            Neons.AddMenuItem(AwaitDelayList);
            // AwaitDelay Dynamic List

            //Adding the neon changer sub menu
            {
                NeonColor = new NeonChanger();
                Menu     NeonChanger = NeonColor.GetMenu();
                MenuItem NeonButton  = new MenuItem($"{Dictionaries.LangNeon[6]}", $"{Dictionaries.LangNeon[7]}")
                {
                    Label = "→→→"
                };
                Neons.AddMenuItem(NeonButton);
                MenuController.BindMenuItem(Neons, NeonChanger, NeonButton);
            }

            //Adding the neon custom sub menu
            {
                NeonCustomMode = new NeonCustom();
                Menu     NeonCustom       = NeonCustomMode.GetMenu();
                MenuItem NeonCustomButton = new MenuItem($"{Dictionaries.LangNeon[8]}", $"{Dictionaries.LangNeon[9]}")
                {
                    Label = "→→→"
                };
                Neons.AddMenuItem(NeonCustomButton);
                MenuController.BindMenuItem(Neons, NeonCustom, NeonCustomButton);
            }


            /*
             ########################################################
             #                  Event handlers
             ########################################################
             */


            Neons.OnDynamicListItemSelect += (_menu, _dynamicListItem, _currentItem) =>
            {
                // Code in here would get executed whenever a dynamic list item is pressed.
                if (MainMenu.DebugMode == true)
                {
                    Debug.WriteLine($"OnDynamicListItemSelect: [{_menu}, {_dynamicListItem}, {_currentItem}]");
                }

                if (_dynamicListItem == AwaitDelayList)
                {
                    RateInput(1);
                }
            };

            Neons.OnCheckboxChange += (_menu, _item, _index, _checked) =>
            {
                // Code in here gets executed whenever a checkbox is toggled.
                if (MainMenu.DebugMode == true)
                {
                    Debug.WriteLine($"OnCheckboxChange: [{_menu}, {_item}, {_index}, {_checked}]");
                }

                if (_item == NeonsRainbow)
                {
                    if (_checked)
                    {
                        PlayerVehicle    = GetVehiclePedIsUsing(PlayerPedId());
                        NeonsRainbowVar1 = true;
                    }
                    else
                    {
                        NeonsRainbowVar1 = false;
                    }
                }

                if (_item == NeonsRainbow2)
                {
                    if (_checked)
                    {
                        PlayerVehicle    = GetVehiclePedIsUsing(PlayerPedId());
                        NeonsRainbowVar2 = true;
                    }
                    else
                    {
                        NeonsRainbowVar2 = false;
                    }
                }
            };
        }
Exemple #9
0
        /// <summary>
        /// Update the items of the main menu
        /// </summary>
        private void UpdateEditorMenu(bool hideWheelSize = false, bool hideWheelWidth = false)
        {
            if (editorMenu == null)
            {
                return;
            }

            editorMenu.ClearMenuItems();

            if (!CurrentPresetIsValid)
            {
                return;
            }

            AddDynamicFloatList(editorMenu, "Front Track Width", -currentPreset.DefaultOffsetX[0], -currentPreset.OffsetX[0], frontMaxOffset, FrontOffsetID);
            AddDynamicFloatList(editorMenu, "Rear Track Width", -currentPreset.DefaultOffsetX[currentPreset.FrontWheelsCount], -currentPreset.OffsetX[currentPreset.FrontWheelsCount], rearMaxOffset, RearOffsetID);
            AddDynamicFloatList(editorMenu, "Front Camber", currentPreset.DefaultRotationY[0], currentPreset.RotationY[0], frontMaxCamber, FrontRotationID);
            AddDynamicFloatList(editorMenu, "Rear Camber", currentPreset.DefaultRotationY[currentPreset.FrontWheelsCount], currentPreset.RotationY[currentPreset.FrontWheelsCount], rearMaxCamber, RearRotationID);
            // Steering lock, custom min max
            if (enableSL)
            {
                var callbackSL = FloatChangeCallback("Steering Lock", currentPreset.SteeringLock, steeringLockMinVal, steeringLockMaxVal, 1f);
                var newitemSL  = new MenuDynamicListItem("Steering Lock", currentPreset.SteeringLock.ToString("F3"), callbackSL)
                {
                    ItemData = SteeringLockID
                };
                editorMenu.AddMenuItem(newitemSL);
            }
            // Suspension height, custom min max
            if (enableSH)
            {
                var callbackSH = FloatChangeCallback("Suspension Height", currentPreset.SuspensionHeight, suspensionHeightMinVal, suspensionHeightMaxVal, 0.005f);
                var newitemSH  = new MenuDynamicListItem("Suspension Height", currentPreset.SuspensionHeight.ToString("F3"), callbackSH)
                {
                    ItemData = SuspensionHeightID
                };
                editorMenu.AddMenuItem(newitemSH);
            }

            // Wheel size, custom min max
            if (enableWS)
            {
                var callbackWS = FloatChangeCallback("Wheel size", currentPreset.WheelSize, wheelSizeMinVal, wheelSizeMaxVal, 0.025f);
                var newitemWS  = new MenuDynamicListItem("Wheel size", currentPreset.WheelSize.ToString("F3"), callbackWS, "Only works on non-default wheels")
                {
                    ItemData = WheelSizeID
                };
                editorMenu.AddMenuItem(newitemWS);

                if (hideWheelSize)
                {
                    newitemWS.Enabled = false;
                }
                else
                {
                    newitemWS.Enabled = true;
                }
            }

            // Wheel width, custom min max
            if (enableWW)
            {
                var callbackWW = FloatChangeCallback("Wheel width", currentPreset.WheelWidth, wheelWidthMinVal, wheelWidthMaxVal, 0.025f);
                var newitemWW  = new MenuDynamicListItem("Wheel width", currentPreset.WheelWidth.ToString("F3"), callbackWW, "Only works on non-default wheels")
                {
                    ItemData = WheelWidthID
                };
                editorMenu.AddMenuItem(newitemWW);

                if (hideWheelWidth)
                {
                    newitemWW.Enabled = false;
                }
                else
                {
                    newitemWW.Enabled = true;
                }
            }

            // Only show collider size/width when not bound to visual params
            if (!enableBinding)
            {
                // Wheel collider size, custom min max
                if (enableWCS)
                {
                    var callbackWCS = FloatChangeCallback("Wheel col size", currentPreset.WheelColSize, wheelColSizeMinVal, wheelColSizeMaxVal, 0.025f);
                    var newitemWCS  = new MenuDynamicListItem("Wheel col size", currentPreset.WheelColSize.ToString("F3"), callbackWCS, "Modify collider radius")
                    {
                        ItemData = WheelColSizeID
                    };
                    editorMenu.AddMenuItem(newitemWCS);
                }
                // Wheel collider width, custom min max
                if (enableWCW)
                {
                    var callbackWCW = FloatChangeCallback("Wheel col width", currentPreset.WheelColWidth, wheelColWidthMinVal, wheelColWidthMaxVal, 0.025f);
                    var newitemWCW  = new MenuDynamicListItem("Wheel col width", currentPreset.WheelColWidth.ToString("F3"), callbackWCW, "Modify collider width")
                    {
                        ItemData = WheelColWidthID
                    };
                    editorMenu.AddMenuItem(newitemWCW);
                }
            }

            editorMenu.AddMenuItem(new MenuItem("Reset", "Restores the default values")
            {
                ItemData = ResetID
            });
            editorMenu.AddMenuItem(new MenuItem("Save preset", "Saves preset for this vehicle")
            {
                ItemData = SaveID
            });
            editorMenu.AddMenuItem(new MenuItem("Load preset", "Loads preset for this vehicle")
            {
                ItemData = LoadID
            });
            editorMenu.AddMenuItem(new MenuItem("Credits", "~g~Carmineos~g~~w~ - Author of vStancer~w~\n" +
                                                "~y~Tom Grobbe~y~~w~ - MenuAPI used for GUI~w~\n" +
                                                "~y~Shrimp~y~~w~ - Additional functionality (SL, SH, wheel size/width, presets)~w~\n" + " \n"));
        }
Exemple #10
0
        //color variables


        private void CreateMenu()
        {
            Paint = new Menu($"{Dictionaries.LangMain[1]}", $"{Dictionaries.LangMain[2]}");

            /*
             ########################################################
             #                   Paint
             */
            //Box for applying primary paint
            MenuCheckboxItem paintPrimary = new MenuCheckboxItem($"{Dictionaries.LangPaint[0]}", $"{Dictionaries.LangPaint[1]}", ApplyColorPrimary)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Tick
            };

            Paint.AddMenuItem(paintPrimary);
            //Box for applying primary paint
            //Box for applying secondary paint
            MenuCheckboxItem paintSecondary = new MenuCheckboxItem($"{Dictionaries.LangPaint[2]}", $"{Dictionaries.LangPaint[1]}", ApplyColorSecondary)
            {
                Style = MenuCheckboxItem.CheckboxStyle.Tick
            };

            Paint.AddMenuItem(paintSecondary);
            //Box for applying secondary paint

            // Red Dynamic List
            string RedDyn(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = RedRGB - 1;
                    if (newvalue < 0)
                    {
                        newvalue = RedRGB = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Red~w~ is 0");
                        }
                    }
                    else
                    {
                        RedRGB = newvalue;
                    }
                }
                else
                {
                    var newvalue = RedRGB + 1;
                    if (newvalue > 255)
                    {
                        newvalue = RedRGB = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Red~w~ is 255");
                        }
                    }
                    else
                    {
                        RedRGB = newvalue;
                    }
                }
                return(RedRGB.ToString());
            }

            MenuDynamicListItem RedDynList = new MenuDynamicListItem($"{Dictionaries.LangPaint[3]}", "0", RedDyn, $"{Dictionaries.LangPaint[4]}");

            Paint.AddMenuItem(RedDynList);
            // Red Dynamic List

            // Green Dynamic List
            string GreenDyn(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = GreenRGB - 1;
                    if (newvalue < 0)
                    {
                        newvalue = GreenRGB = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        GreenRGB = newvalue;
                    }
                }
                else
                {
                    var newvalue = GreenRGB + 1;
                    if (newvalue > 255)
                    {
                        newvalue = GreenRGB = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        GreenRGB = newvalue;
                    }
                }
                return(GreenRGB.ToString());
            }

            MenuDynamicListItem GreenDynList = new MenuDynamicListItem($"{Dictionaries.LangPaint[5]}", "0", GreenDyn, $"{Dictionaries.LangPaint[6]}");

            Paint.AddMenuItem(GreenDynList);
            // Green Dynamic List

            // Blue Dynamic List
            string BlueDyn(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = BlueRGB - 1;
                    if (newvalue < 0)
                    {
                        newvalue = BlueRGB = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        BlueRGB = newvalue;
                    }
                }
                else
                {
                    var newvalue = BlueRGB + 1;
                    if (newvalue > 255)
                    {
                        newvalue = BlueRGB = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        BlueRGB = newvalue;
                    }
                }
                return(BlueRGB.ToString());
            }

            MenuDynamicListItem BlueDynList = new MenuDynamicListItem($"{Dictionaries.LangPaint[7]}", "0", BlueDyn, $"{Dictionaries.LangPaint[8]}");

            Paint.AddMenuItem(BlueDynList);
            // Blue Dynamic List

            /*
             *       Paint
             ########################################################
             */

            /*
             ########################################################
             #                  Event handlers
             ########################################################
             */
            Paint.OnDynamicListItemSelect += (_menu, _dynamicListItem, _currentItem) =>
            {
                // Code in here would get executed whenever a dynamic list item is pressed.
                if (MainMenu.DebugMode == true)
                {
                    Debug.WriteLine($"OnDynamicListItemSelect: [{_menu}, {_dynamicListItem}, {_currentItem}]");
                }

                if (_dynamicListItem == RedDynList)
                {
                    PaintInput(1);
                }

                if (_dynamicListItem == GreenDynList)
                {
                    PaintInput(2);
                }

                if (_dynamicListItem == BlueDynList)
                {
                    PaintInput(3);
                }
            };


            Paint.OnDynamicListItemCurrentItemChange += (_menu, _dynamicListItem, _oldCurrentItem, __newCurrentItem) =>
            {
                // Code in here would get executed whenever the value of the current item of a dynamic list item changes.
                if (MainMenu.DebugMode == true)
                {
                    Debug.WriteLine($"OnMenuDynamicListItemCurrentItemChange: [{_menu}, {_dynamicListItem}, {_oldCurrentItem}, {__newCurrentItem}]");
                }

                if (_dynamicListItem == RedDynList)
                {
                    if (ApplyColorPrimary == true)
                    {
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomPrimaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    if (ApplyColorSecondary == true)
                    {
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomSecondaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    if (MainMenu.DebugMode == true)
                    {
                        Debug.Write($"{RedRGB}");
                    }
                    else
                    {
                        return;
                    }
                }

                if (_dynamicListItem == GreenDynList)
                {
                    if (ApplyColorPrimary == true)
                    {
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomPrimaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    if (ApplyColorSecondary == true)
                    {
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomSecondaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    if (MainMenu.DebugMode == true)
                    {
                        Debug.Write($"{GreenRGB}");
                    }
                    else
                    {
                        return;
                    }
                }

                if (_dynamicListItem == BlueDynList)
                {
                    if (ApplyColorPrimary == true)
                    {
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomPrimaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    if (ApplyColorSecondary == true)
                    {
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomSecondaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    if (MainMenu.DebugMode == true)
                    {
                        Debug.Write($"{BlueRGB}");
                    }
                    else
                    {
                        return;
                    }
                }
            };

            Paint.OnCheckboxChange += (_menu, _item, _index, _checked) =>
            {
                // Code in here gets executed whenever a checkbox is toggled.
                if (MainMenu.DebugMode == true)
                {
                    Debug.WriteLine($"OnCheckboxChange: [{_menu}, {_item}, {_index}, {_checked}]");
                }
                if (_item == paintPrimary)
                {
                    if (_checked)
                    {
                        ApplyColorPrimary = true;
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomPrimaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    else
                    {
                        ApplyColorPrimary = false;
                    }
                }

                if (_item == paintSecondary)
                {
                    if (_checked)
                    {
                        ApplyColorSecondary = true;
                        var PlayerVehicle = GetPlayersLastVehicle();
                        SetVehicleCustomSecondaryColour(PlayerVehicle, RedRGB, GreenRGB, BlueRGB);
                    }
                    else
                    {
                        ApplyColorSecondary = false;
                    }
                }
            };
        }
Exemple #11
0
        private void CreateMenu()
        {
            NeonColor = new Menu("Neon Colors", "Neon tuning");

            #region Neon1
            // Red Dynamic List
            string RedDyn1(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.RedNeon1 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.RedNeon1 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Red~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon1 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.RedNeon1 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.RedNeon1 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Red~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon1 = newvalue;
                    }
                }
                return(NeonMenu.RedNeon1.ToString());
            }

            MenuDynamicListItem RedDynList1 = new MenuDynamicListItem("Red Left", "222", RedDyn1, "Set the red in RGB.");
            NeonColor.AddMenuItem(RedDynList1);
            // Red Dynamic List

            // Green Dynamic List
            string GreenDyn1(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.GreenNeon1 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.GreenNeon1 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon1 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.GreenNeon1 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.GreenNeon1 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon1 = newvalue;
                    }
                }
                return(NeonMenu.GreenNeon1.ToString());
            }

            MenuDynamicListItem GreenDynList1 = new MenuDynamicListItem("Green Left", "222", GreenDyn1, "Set the Green in RGB.");
            NeonColor.AddMenuItem(GreenDynList1);
            // Green Dynamic List

            // Blue Dynamic List
            string BlueDyn1(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.BlueNeon1 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.BlueNeon1 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon1 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.BlueNeon1 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.BlueNeon1 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon1 = newvalue;
                    }
                }
                return(NeonMenu.BlueNeon1.ToString());
            }

            MenuDynamicListItem BlueDynList1 = new MenuDynamicListItem("Blue Left", "255", BlueDyn1, "Set the Blue in RGB.");
            NeonColor.AddMenuItem(BlueDynList1);
            // Blue Dynamic List
            #endregion

            NeonColor.AddMenuItem(new MenuItem("====", "This is a separator!"));

            #region Neon2
            // Red Dynamic List
            string RedDyn2(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.RedNeon2 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.RedNeon2 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Red~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon2 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.RedNeon2 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.RedNeon2 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Red~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon2 = newvalue;
                    }
                }
                return(NeonMenu.RedNeon2.ToString());
            }

            MenuDynamicListItem RedDynList2 = new MenuDynamicListItem("Red Front", "3", RedDyn2, "Set the red in RGB.");
            NeonColor.AddMenuItem(RedDynList2);
            // Red Dynamic List

            // Green Dynamic List
            string GreenDyn2(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.GreenNeon2 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.GreenNeon2 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon2 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.GreenNeon2 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.GreenNeon2 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon2 = newvalue;
                    }
                }
                return(NeonMenu.GreenNeon2.ToString());
            }

            MenuDynamicListItem GreenDynList2 = new MenuDynamicListItem("Green Front", "83", GreenDyn2, "Set the Green in RGB.");
            NeonColor.AddMenuItem(GreenDynList2);
            // Green Dynamic List

            // Blue Dynamic List
            string BlueDyn2(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.BlueNeon2 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.BlueNeon2 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon2 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.BlueNeon2 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.BlueNeon2 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon2 = newvalue;
                    }
                }
                return(NeonMenu.BlueNeon2.ToString());
            }

            MenuDynamicListItem BlueDynList2 = new MenuDynamicListItem("Blue Front", "255", BlueDyn2, "Set the Blue in RGB.");
            NeonColor.AddMenuItem(BlueDynList2);
            // Blue Dynamic List
            #endregion

            NeonColor.AddMenuItem(new MenuItem("====", "This is a separator!"));

            #region Neon3
            // Red Dynamic List
            string RedDyn3(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.RedNeon3 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.RedNeon3 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Red~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon3 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.RedNeon3 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.RedNeon3 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Red~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon3 = newvalue;
                    }
                }
                return(NeonMenu.RedNeon3.ToString());
            }

            MenuDynamicListItem RedDynList3 = new MenuDynamicListItem("Red Right", "0", RedDyn3, "Set the red in RGB.");
            NeonColor.AddMenuItem(RedDynList3);
            // Red Dynamic List

            // Green Dynamic List
            string GreenDyn3(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.GreenNeon3 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.GreenNeon3 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon3 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.GreenNeon3 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.GreenNeon3 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon3 = newvalue;
                    }
                }
                return(NeonMenu.GreenNeon3.ToString());
            }

            MenuDynamicListItem GreenDynList3 = new MenuDynamicListItem("Green Right", "250", GreenDyn3, "Set the Green in RGB.");
            NeonColor.AddMenuItem(GreenDynList3);
            // Green Dynamic List

            // Blue Dynamic List
            string BlueDyn3(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.BlueNeon3 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.BlueNeon3 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon3 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.BlueNeon3 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.BlueNeon3 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon3 = newvalue;
                    }
                }
                return(NeonMenu.BlueNeon3.ToString());
            }

            MenuDynamicListItem BlueDynList3 = new MenuDynamicListItem("Blue Right", "140", BlueDyn3, "Set the Blue in RGB.");
            NeonColor.AddMenuItem(BlueDynList3);
            // Blue Dynamic List
            #endregion

            NeonColor.AddMenuItem(new MenuItem("====", "This is a separator!"));

            #region Neon4
            // Red Dynamic List
            string RedDyn4(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.RedNeon4 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.RedNeon4 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Red~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon4 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.RedNeon4 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.RedNeon4 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Red~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.RedNeon4 = newvalue;
                    }
                }
                return(NeonMenu.RedNeon4.ToString());
            }

            MenuDynamicListItem RedDynList4 = new MenuDynamicListItem("Red Back", "255", RedDyn4, "Set the red in RGB.");
            NeonColor.AddMenuItem(RedDynList4);
            // Red Dynamic List

            // Green Dynamic List
            string GreenDyn4(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.GreenNeon4 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.GreenNeon4 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon4 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.GreenNeon4 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.GreenNeon4 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.GreenNeon4 = newvalue;
                    }
                }
                return(NeonMenu.GreenNeon4.ToString());
            }

            MenuDynamicListItem GreenDynList4 = new MenuDynamicListItem("Green Back", "255", GreenDyn4, "Set the Green in RGB.");
            NeonColor.AddMenuItem(GreenDynList4);
            // Green Dynamic List

            // Blue Dynamic List
            string BlueDyn4(MenuDynamicListItem item, bool left)
            {
                if (left)
                {
                    var newvalue = NeonMenu.BlueNeon4 - 1;
                    if (newvalue < 0)
                    {
                        newvalue = NeonMenu.BlueNeon4 = 255;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Min value allowed for ~b~Green~w~ is 0");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon4 = newvalue;
                    }
                }
                else
                {
                    var newvalue = NeonMenu.BlueNeon4 + 1;
                    if (newvalue > 255)
                    {
                        newvalue = NeonMenu.BlueNeon4 = 0;

                        if (MainMenu.DebugMode == true)
                        {
                            Screen.ShowNotification($"AlsekRGB: Max value allowed for ~b~Green~w~ is 255");
                        }
                    }
                    else
                    {
                        NeonMenu.BlueNeon4 = newvalue;
                    }
                }
                return(NeonMenu.BlueNeon4.ToString());
            }

            MenuDynamicListItem BlueDynList4 = new MenuDynamicListItem("Blue Back", "0", BlueDyn4, "Set the Blue in RGB.");
            NeonColor.AddMenuItem(BlueDynList4);
            // Blue Dynamic List
            #endregion

            /*
             ########################################################
             #                  Event handlers
             ########################################################
             */

            NeonColor.OnDynamicListItemSelect += (_menu, _dynamicListItem, _currentItem) =>
            {
                // Code in here would get executed whenever a dynamic list item is pressed.
                if (MainMenu.DebugMode == true)
                {
                    Debug.WriteLine($"OnDynamicListItemSelect: [{_menu}, {_dynamicListItem}, {_currentItem}]");
                }

                if (_dynamicListItem == RedDynList1)
                {
                    PaintInput(1, 1);
                }

                if (_dynamicListItem == GreenDynList1)
                {
                    PaintInput(2, 2);
                }

                if (_dynamicListItem == BlueDynList1)
                {
                    PaintInput(3, 3);
                }

                if (_dynamicListItem == RedDynList2)
                {
                    PaintInput(1, 4);
                }

                if (_dynamicListItem == GreenDynList2)
                {
                    PaintInput(2, 5);
                }

                if (_dynamicListItem == BlueDynList2)
                {
                    PaintInput(3, 6);
                }

                if (_dynamicListItem == RedDynList3)
                {
                    PaintInput(1, 7);
                }

                if (_dynamicListItem == GreenDynList3)
                {
                    PaintInput(2, 8);
                }

                if (_dynamicListItem == BlueDynList3)
                {
                    PaintInput(3, 9);
                }

                if (_dynamicListItem == RedDynList4)
                {
                    PaintInput(1, 10);
                }

                if (_dynamicListItem == GreenDynList4)
                {
                    PaintInput(2, 11);
                }

                if (_dynamicListItem == BlueDynList4)
                {
                    PaintInput(3, 12);
                }
            };
        }