void ParseSettings()
        {
            try
            {
                settings = ScriptSettings.Load(@".\scripts\Metric_Speedometer.ini");

                // Parse Core settings
                this.useMph     = settings.GetValue("Core", "UseMph", false);
                this.speedoMode = (SpeedoMode)settings.GetValue <int>("Core", "DisplayMode", 1);
                this.enableMenu = settings.GetValue("Core", "EnableMenu", true);
                if (enableMenu)
                {
                    this.menuKey = (Keys)Enum.Parse(typeof(Keys), settings.GetValue("Core", "MenuKey"), true);
                }
                this.enableSaving = settings.GetValue("Core", "EnableSaving", true);
                this.rainbowMode  = settings.GetValue("Core", "RainbowMode", 0);
                this.onfootSpeedo = settings.GetValue("Core", "OnfootSpeedo", false);

                // Parse UI settings
                this.vAlign    = (VerticalAlignment)Enum.Parse(typeof(VerticalAlignment), settings.GetValue("UI", "VertAlign"), true);
                this.hAlign    = (HorizontalAlign)Enum.Parse(typeof(HorizontalAlign), settings.GetValue("UI", "HorzAlign"), true);
                this.posOffset = new Point(settings.GetValue <int>("UI", "OffsetX", 0), settings.GetValue <int>("UI", "OffsetY", 0));
                this.pWidth    = settings.GetValue("UI", "PanelWidth", 66);
                this.pHeight   = settings.GetValue("UI", "PanelHeight", 24);
                this.fontSize  = float.Parse(settings.GetValue("UI", "FontSize"), CultureInfo.InvariantCulture.NumberFormat);
                this.fontStyle = settings.GetValue("UI", "FontStyle", 4);
                this.backcolor = Color.FromArgb(settings.GetValue <int>("UI", "BackcolorA", 200), settings.GetValue <int>("UI", "BackcolorR", 237),
                                                settings.GetValue <int>("UI", "BackcolorG", 239), settings.GetValue <int>("UI", "BackcolorB", 241));
                this.forecolor = Color.FromArgb(settings.GetValue <int>("UI", "ForecolorA", 255), settings.GetValue <int>("UI", "ForecolorR", 0),
                                                settings.GetValue <int>("UI", "ForecolorG", 0), settings.GetValue <int>("UI", "ForecolorB", 0));
                this.kphText = settings.GetValue("Text", "KphText", "km/h");
                this.mphText = settings.GetValue("Text", "MphText", "mph");

                // Load stats
                if (enableSaving)
                {
                    LoadStats();
                }
            }
            catch { UI.Notify("~r~failed to load speedometer config"); }
        }
Ejemplo n.º 2
0
        void SetupMenus()
        {
            // Create main menu
            MenuButton btnToggle = new MenuButton("", delegate { speedoMode = (SpeedoMode)(((int)speedoMode + 1) % Enum.GetNames(typeof(SpeedoMode)).Length); UpdateMainButtons(0); });
            MenuButton btnClear  = new MenuButton("Reset Odometer", delegate { distanceKm = 0; UI.Notify("Odometer reset"); });
            MenuButton btnCore   = new MenuButton("Core Settings >", delegate { View.AddMenu(coreMenu); });
            MenuButton btnDisp   = new MenuButton("Display Settings >", delegate { View.AddMenu(dispMenu); });
            MenuButton btnExtra  = new MenuButton("Extras >", delegate
            {
                MenuButton btnShowCredits = new MenuButton("Show Credits", ShowCredits);
                MenuButton btnUpdates     = new MenuButton("Check for Updates", CheckForUpdates);
                GTA.Menu extraMenu        = new GTA.Menu("Extras", new GTA.MenuItem[] { btnShowCredits, btnUpdates });
                extraMenu.HasFooter       = false;
                View.AddMenu(extraMenu);
            });
            MenuButton btnReload = new MenuButton("Reload", delegate { ParseSettings(); SetupUIElements(); UI.Notify("Speedometer reloaded");
                                                                       UpdateMainButtons(5); UpdateCoreButtons(0); UpdateDispButtons(0); UpdateColorButtons(0); });
            MenuButton btnBack = new MenuButton("Save & Exit", delegate { View.CloseAllMenus(); });

            mainMenuItems           = new GTA.MenuItem[] { btnToggle, btnClear, btnCore, btnDisp, btnExtra, btnReload, btnBack };
            this.mainMenu           = new MySettingsMenu("Speedometer v" + SCRIPT_VERSION, mainMenuItems, this);
            this.mainMenu.HasFooter = false;

            // Create core menu
            MenuButton btnUseMph       = new MenuButton("", delegate { useMph = !useMph; UpdateCoreButtons(0); });
            MenuButton btnEnableSaving = new MenuButton("", delegate { enableSaving = !enableSaving; UpdateCoreButtons(1); });

            //MenuButton btnEnableMenu = new MenuButton("Disable Menu Key", delegate { enableMenu = !enableMenu; UpdateCoreButtons(2); });
            coreMenuItems           = new GTA.MenuItem[] { btnUseMph, btnEnableSaving };
            this.coreMenu           = new GTA.Menu("Core Settings", coreMenuItems);
            this.coreMenu.HasFooter = false;

            // Create display menu
            MenuButton btnVAlign    = new MenuButton("", delegate { vAlign = (VerticalAlignment)(((int)vAlign + 1) % 3); posOffset.Y = 0; SetupUIElements(); UpdateDispButtons(0); });
            MenuButton btnHAlign    = new MenuButton("", delegate { hAlign = (HorizontalAlign)(((int)hAlign + 1) % 3); posOffset.X = 0; SetupUIElements(); UpdateDispButtons(1); });
            MenuButton btnFontStyle = new MenuButton("", delegate { fontStyle = ++fontStyle % NUM_FONTS; SetupUIElements(); UpdateDispButtons(2); });
            MenuButton btnFontSize  = new MenuButton("Font Size >", delegate
            {
                MenuButton btnAddSize = new MenuButton("+ Font Size", delegate { fontSize += 0.02f; SetupUIElements(); });
                MenuButton btnSubSize = new MenuButton("- Font Size", delegate { fontSize -= 0.02f; SetupUIElements(); });
                GTA.Menu sizeMenu     = new GTA.Menu("Font Size", new GTA.MenuItem[] { btnAddSize, btnSubSize });
                sizeMenu.HasFooter    = false;
                View.AddMenu(sizeMenu);
            });
            MenuButton btnPanelSize = new MenuButton("Panel Size >", delegate
            {
                MenuButton btnAddWidth  = new MenuButton("+ Panel Width", delegate { pWidth += 2; SetupUIElements(); });
                MenuButton btnSubWidth  = new MenuButton("- Panel Width", delegate { pWidth -= 2; SetupUIElements(); });
                MenuButton btnAddHeight = new MenuButton("+ Panel Height", delegate { pHeight += 2; SetupUIElements(); });
                MenuButton btnSubHeight = new MenuButton("- Panel Height", delegate { pHeight -= 2; SetupUIElements(); });
                GTA.Menu panelSizeMenu  = new GTA.Menu("Panel Size", new GTA.MenuItem[] { btnAddWidth, btnSubWidth, btnAddHeight, btnSubHeight });
                panelSizeMenu.HasFooter = false;
                View.AddMenu(panelSizeMenu);
            });
            MenuButton btnAplyOffset = new MenuButton("Set Offset >", delegate
            {
                MenuButton btnOffsetUp    = new MenuButton("Move Up", delegate { posOffset.Y += -2; SetupUIElements(); });
                MenuButton btnOffsetDown  = new MenuButton("Move Down", delegate { posOffset.Y += 2; SetupUIElements(); });
                MenuButton btnOffsetLeft  = new MenuButton("Move Left", delegate { posOffset.X += -2; SetupUIElements(); });
                MenuButton btnOffsetRight = new MenuButton("Move Right", delegate { posOffset.X += 2; SetupUIElements(); });
                MenuButton btnOffsetClr   = new MenuButton("Clear Offset", delegate { posOffset.X = 0; posOffset.Y = 0; SetupUIElements(); });
                GTA.Menu offsetMenu       = new GTA.Menu("Set Offset", new GTA.MenuItem[] { btnOffsetUp, btnOffsetDown, btnOffsetLeft, btnOffsetRight, btnOffsetClr });
                offsetMenu.HasFooter      = false;
                View.AddMenu(offsetMenu);
            });
            MenuButton btnBackcolor  = new MenuButton("Back Color >", delegate { isChangingBackcolor = true; UpdateColorButtons(0); View.AddMenu(colorMenu); });
            MenuButton btnForecolor  = new MenuButton("Fore Color >", delegate { isChangingBackcolor = false; UpdateColorButtons(0); View.AddMenu(colorMenu); });
            MenuButton btnRstDefault = new MenuButton("Restore to Default", delegate { ResetUIToDefault(); UpdateDispButtons(8); });

            dispMenuItems           = new GTA.MenuItem[] { btnVAlign, btnHAlign, btnFontStyle, btnAplyOffset, btnFontSize, btnPanelSize, btnBackcolor, btnForecolor, btnRstDefault };
            this.dispMenu           = new GTA.Menu("Display Settings", dispMenuItems);
            this.dispMenu.HasFooter = false;

            // Create color menu
            MenuButton btnAddR = new MenuButton("+ R", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, 0, 5, 0, 0);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, 0, 5, 0, 0);
                }
                SetupUIElements(); UpdateColorButtons(0);
            });
            MenuButton btnSubR = new MenuButton("- R", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, 0, -5, 0, 0);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, 0, -5, 0, 0);
                }
                SetupUIElements(); UpdateColorButtons(1);
            });
            MenuButton btnAddG = new MenuButton("+ G", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, 0, 0, 5, 0);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, 0, 0, 5, 0);
                }
                SetupUIElements(); UpdateColorButtons(2);
            });
            MenuButton btnSubG = new MenuButton("- G", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, 0, 0, -5, 0);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, 0, 0, -5, 0);
                }
                SetupUIElements(); UpdateColorButtons(3);
            });
            MenuButton btnAddB = new MenuButton("+ B", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, 0, 0, 0, 5);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, 0, 0, 0, 5);
                }
                SetupUIElements(); UpdateColorButtons(4);
            });
            MenuButton btnSubB = new MenuButton("- B", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, 0, 0, 0, -5);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, 0, 0, 0, -5);
                }
                SetupUIElements(); UpdateColorButtons(5);
            });
            MenuButton btnAddA = new MenuButton("+ Opacity", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, 5, 0, 0, 0);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, 5, 0, 0, 0);
                }
                SetupUIElements(); UpdateColorButtons(6);
            });
            MenuButton btnSubA = new MenuButton("- Opacity", delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = IncrementARGB(backcolor, -5, 0, 0, 0);
                }
                else
                {
                    forecolor = IncrementARGB(forecolor, -5, 0, 0, 0);
                }
                SetupUIElements(); UpdateColorButtons(7);
            });

            colorMenuItems               = new GTA.MenuItem[] { btnAddR, btnSubR, btnAddG, btnSubG, btnAddB, btnSubB, btnAddA, btnSubA };
            this.colorMenu               = new GTA.Menu("", colorMenuItems);
            this.colorMenu.HasFooter     = false;
            this.colorMenu.HeaderHeight += 20;

            UpdateMainButtons(0);
            UpdateCoreButtons(0);
            UpdateDispButtons(0);
            UpdateColorButtons(0);
        }
Ejemplo n.º 3
0
        void SetupMenus()
        {
            // Create main menu
            UIMenuListItem btnToggle = new UIMenuListItem("Toggle Display", new List <dynamic>(Enum.GetNames(typeof(SpeedoMode))), 0);

            btnToggle.OnListChanged += delegate(UIMenuListItem item, int index)
            {
                speedoMode = (SpeedoMode)(((int)index) % Enum.GetNames(typeof(SpeedoMode)).Length);
            };
            UIMenuItem btnClear = new UIMenuItem("Reset Trip Meter");

            btnClear.Activated += delegate { distanceKm = 0; UI.Notify("Trip meter reset"); };
            UIMenuItem btnCore = new UIMenuItem("Core Settings");

            btnCore.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            UIMenuItem btnDisp = new UIMenuItem("Display Settings");

            btnDisp.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            UIMenuItem btnExtras = new UIMenuItem("Extras");

            btnExtras.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            UIMenuItem btnReload = new UIMenuItem("Reload");

            btnReload.Activated += delegate
            {
                ParseSettings(); SetupUIElements();
                UpdateAllMenuButtons();
                UI.Notify("Speedometer reloaded");
            };
            UIMenuItem btnBack = new UIMenuItem("Save & Close");

            btnBack.Activated += delegate { SaveSettings(); mainMenu.Visible = false; };

            mainMenu = new UIMenu(GetTitle(), "By libertylocked");
            foreach (UIMenuItem item in new UIMenuItem[] { btnToggle, btnClear, btnCore, btnDisp, btnExtras, btnReload, btnBack })
            {
                mainMenu.AddItem(item);
            }
            mainMenu.OnMenuClose += delegate { SaveSettings(); };

            // Create core menu
            UIMenuListItem btnUseMph = new UIMenuListItem("Speed Unit", new List <dynamic> {
                "Imperial", "Metric"
            }, 0, "Sets the unit between KPH and MPH");

            btnUseMph.OnListChanged += delegate(UIMenuListItem item, int index)
            {
                useMph = index % 2 == 0; UpdateAllMenuButtons();;
            };
            UIMenuCheckboxItem btnEnableSaving = new UIMenuCheckboxItem("Save Trip Meter", false, "Allows trip meter data to be persistent across game sessions");

            btnEnableSaving.CheckboxEvent += new ItemCheckboxEvent(delegate(UIMenuCheckboxItem item, bool selected)
            {
                enableSaving = selected;
            });
            UIMenuCheckboxItem btnOnfootSpeedo = new UIMenuCheckboxItem("Onfoot Speed", false, "Shows speed when player is on foot");

            btnOnfootSpeedo.CheckboxEvent += new ItemCheckboxEvent(delegate(UIMenuCheckboxItem item, bool selected)
            {
                onfootSpeedo = selected;
            });

            coreMenu = new UIMenu(GetTitle(), "Core Settings");
            foreach (UIMenuItem item in new UIMenuItem[] { btnUseMph, btnEnableSaving, btnOnfootSpeedo })
            {
                coreMenu.AddItem(item);
            }
            mainMenu.BindMenuToItem(coreMenu, btnCore);

            // Create display menu
            UIMenuListItem btnVAlign = new UIMenuListItem("Vertical Alignment", new List <dynamic>(Enum.GetNames(typeof(VerticalAlignment))), 0, "Determines how speedometer display will be aligned vertically");

            btnVAlign.OnListChanged += delegate(UIMenuListItem item, int index)
            {
                vAlign = (VerticalAlignment)(((int)index) % 3); posOffset.Y = 0; SetupUIElements();
            };
            UIMenuListItem btnHAlign = new UIMenuListItem("Horizontal Alignment", new List <dynamic>(Enum.GetNames(typeof(HorizontalAlign))), 0, "Determines how speedometer display will be aligned horizontally");

            btnHAlign.OnListChanged += delegate(UIMenuListItem item, int index)
            {
                hAlign = (HorizontalAlign)(((int)index) % 3); posOffset.X = 0; SetupUIElements();
            };
            UIMenuListItem btnFontStyle = new UIMenuListItem("Font Style", new List <dynamic>(Enum.GetNames(typeof(GTA.Font))), 0, "Sets the font on speedometer display");

            btnFontStyle.OnListChanged += delegate(UIMenuListItem item, int index)
            {
                fontStyle = (int)((GTA.Font[])Enum.GetValues(typeof(GTA.Font)))[index]; SetupUIElements();
            };
            UIMenuItem btnFontSize = new UIMenuItem("Font Size", "Sets the size of text on speedometer");

            btnFontSize.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            UIMenuItem btnPanelSize = new UIMenuItem("Panel Size", "Sets the size of the back rectangle");

            btnPanelSize.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            UIMenuItem btnOffset = new UIMenuItem("Apply Offset", "Applies an offset to speedometer display, to fine tune its position");

            btnOffset.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            UIMenuItem btnBackcolor = new UIMenuItem("Back Color", "Sets the color of the background panel");

            btnBackcolor.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            btnBackcolor.Activated += delegate { isChangingBackcolor = true; UpdateAllMenuButtons(); };
            UIMenuItem btnForecolor = new UIMenuItem("Fore Color", "Sets the color of the text");

            btnForecolor.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            btnForecolor.Activated += delegate { isChangingBackcolor = false; UpdateAllMenuButtons(); };
            UIMenuItem btnTxt = new UIMenuItem("Speed Unit Text", "Changes the text for speed unit");

            btnTxt.Activated += delegate
            {
                string input = Game.GetUserInput(WindowTitle.CELL_EMASH_BOD, useMph ? mphText : kphText, 20);
                if (useMph)
                {
                    mphText = input;
                }
                else
                {
                    kphText = input;
                }
            };
            UIMenuItem btnRstDefault = new UIMenuItem("Restore to Default", "Resets UI to default settings");

            btnRstDefault.Activated += delegate { ResetUIToDefault(); UpdateAllMenuButtons(); };

            dispMenu = new UIMenu(GetTitle(), "Display Settings");
            foreach (UIMenuItem item in new UIMenuItem[] { btnVAlign, btnHAlign, btnFontStyle, btnFontSize, btnPanelSize, btnOffset, btnBackcolor, btnForecolor, btnTxt, btnRstDefault })
            {
                dispMenu.AddItem(item);
            }
            mainMenu.BindMenuToItem(dispMenu, btnDisp);

            // Create font size menu
            UIMenuItem btnAddSize = new UIMenuItem("+ Font Size");

            btnAddSize.Activated += delegate { fontSize += 0.02f; SetupUIElements(); };
            UIMenuItem btnSubSize = new UIMenuItem("- Font Size");

            btnSubSize.Activated += delegate { fontSize -= 0.02f; SetupUIElements(); };
            UIMenu sizeMenu = new UIMenu(GetTitle(), "Font Size");

            sizeMenu.AddItem(btnAddSize);
            sizeMenu.AddItem(btnSubSize);
            dispMenu.BindMenuToItem(sizeMenu, btnFontSize);

            // Create panel size menu
            UIMenuItem btnAddWidth = new UIMenuItem("+ Panel Width");

            btnAddWidth.Activated += delegate { pWidth += 2; SetupUIElements(); };
            UIMenuItem btnSubWidth = new UIMenuItem("- Panel Width");

            btnSubWidth.Activated += delegate { pWidth -= 2; SetupUIElements(); };
            UIMenuItem btnAddHeight = new UIMenuItem("+ Panel Height");

            btnAddHeight.Activated += delegate { pHeight += 2; SetupUIElements(); };
            UIMenuItem btnSubHeight = new UIMenuItem("- Panel Height");

            btnSubHeight.Activated += delegate { pHeight -= 2; SetupUIElements(); };
            UIMenu panelSizeMenu = new UIMenu(GetTitle(), "Panel Size");

            panelSizeMenu.AddItem(btnAddWidth);
            panelSizeMenu.AddItem(btnSubWidth);
            panelSizeMenu.AddItem(btnAddHeight);
            panelSizeMenu.AddItem(btnSubHeight);
            dispMenu.BindMenuToItem(panelSizeMenu, btnPanelSize);

            // Create offset menu
            UIMenuItem btnOffsetUp = new UIMenuItem("Move Up");

            btnOffsetUp.Activated += delegate { posOffset.Y += -2; SetupUIElements(); };
            UIMenuItem btnOffsetDown = new UIMenuItem("Move Down");

            btnOffsetDown.Activated += delegate { posOffset.Y += 2; SetupUIElements(); };
            UIMenuItem btnOffsetLeft = new UIMenuItem("Move Left");

            btnOffsetLeft.Activated += delegate { posOffset.X += -2; SetupUIElements(); };
            UIMenuItem btnOffsetRight = new UIMenuItem("Move Right");

            btnOffsetRight.Activated += delegate { posOffset.X += 2; SetupUIElements(); };
            UIMenuItem btnOffsetClr = new UIMenuItem("Clear Offset");

            btnOffsetClr.Activated += delegate { posOffset.X = 0; posOffset.Y = 0; SetupUIElements(); };
            UIMenu offsetMenu = new UIMenu(GetTitle(), "Apply Offset");

            offsetMenu.AddItem(btnOffsetUp);
            offsetMenu.AddItem(btnOffsetDown);
            offsetMenu.AddItem(btnOffsetLeft);
            offsetMenu.AddItem(btnOffsetRight);
            offsetMenu.AddItem(btnOffsetClr);
            dispMenu.BindMenuToItem(offsetMenu, btnOffset);

            // Create color menu
            UIMenuItem btnAddR = new UIMenuItem("+ R");

            btnAddR.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, 0, 5, 0, 0);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, 0, 5, 0, 0);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            UIMenuItem btnSubR = new UIMenuItem("- R");

            btnSubR.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, 0, -5, 0, 0);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, 0, -5, 0, 0);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            UIMenuItem btnAddG = new UIMenuItem("+ G");

            btnAddG.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, 0, 0, 5, 0);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, 0, 0, 5, 0);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            UIMenuItem btnSubG = new UIMenuItem("- G");

            btnSubG.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, 0, 0, -5, 0);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, 0, 0, -5, 0);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            UIMenuItem btnAddB = new UIMenuItem("+ B");

            btnAddB.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, 0, 0, 0, 5);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, 0, 0, 0, 5);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            UIMenuItem btnSubB = new UIMenuItem("- B");

            btnSubB.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, 0, 0, 0, -5);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, 0, 0, 0, -5);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            UIMenuItem btnAddA = new UIMenuItem("+ Opacity");

            btnAddA.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, 5, 0, 0, 0);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, 5, 0, 0, 0);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            UIMenuItem btnSubA = new UIMenuItem("- Opacity");

            btnSubA.Activated += delegate
            {
                if (isChangingBackcolor)
                {
                    backcolor = Utils.IncrementARGB(backcolor, -5, 0, 0, 0);
                }
                else
                {
                    forecolor = Utils.IncrementARGB(forecolor, -5, 0, 0, 0);
                }
                SetupUIElements(); UpdateAllMenuButtons();
            };
            colorMenu = new UIMenu(GetTitle(), "Set Color");
            foreach (UIMenuItem item in new UIMenuItem[] { btnAddR, btnSubR, btnAddG, btnSubG, btnAddB, btnSubB, btnAddA, btnSubA })
            {
                colorMenu.AddItem(item);
            }
            dispMenu.BindMenuToItem(colorMenu, btnBackcolor);
            dispMenu.BindMenuToItem(colorMenu, btnForecolor);

            // Create extras menu
            UIMenuListItem btnRainbowMode = new UIMenuListItem("Rainbow Mode", new List <dynamic> {
                "Off", "1x", "2x", "4x", "8x", "16x", "32x", "64x"
            }, 0);

            btnRainbowMode.OnListChanged += delegate(UIMenuListItem item, int index)
            {
                rainbowMode = index;
                SetupUIElements();
            };
            UIMenuItem btnAccTimer = new UIMenuItem("0-100kph/62mph Timer");

            btnAccTimer.Activated += delegate { wid_accTimer.Toggle(); };
            UIMenuItem btnMaxSpeed = new UIMenuItem("Top Speed Recorder");

            btnMaxSpeed.Activated += delegate { wid_maxSpeed.Toggle(); };
            UIMenuItem btnShowCredits = new UIMenuItem("Show Credits");

            btnShowCredits.Activated += delegate { ShowCredits(); };

            extrasMenu = new UIMenu(GetTitle(), "Extras");
            foreach (UIMenuItem item in new UIMenuItem[] { btnRainbowMode, btnAccTimer, btnMaxSpeed, btnShowCredits })
            {
                extrasMenu.AddItem(item);
            }
            mainMenu.BindMenuToItem(extrasMenu, btnExtras);

            menuPool = new MenuPool();
            menuPool.Add(mainMenu);
            menuPool.Add(coreMenu);
            menuPool.Add(dispMenu);
            menuPool.Add(extrasMenu);
            menuPool.Add(sizeMenu);
            menuPool.Add(panelSizeMenu);
            menuPool.Add(offsetMenu);
            menuPool.Add(colorMenu);
        }