private void RenderSubMenu()
        {
            _refreshMenuItem = new NSMenuItem("Refresh")
            {
                Title = "Refresh",
            };
            _refreshMenuItem.Activated += OnRefreshClickedInternal;

            _refreshAllMenuItem = new NSMenuItem("RefreshAll")
            {
                Title = "Refresh All",
            };
            _refreshAllMenuItem.Activated += OnRefreshAllClickedInternal;

            _settingsMenuItem = new NSMenuItem("Preferences")
            {
                Title = "Preferences",
            };
            _settingsMenuItem.Activated += OnPreferencesClickedInternal;

            _quitMenuItem = new NSMenuItem("Quit")
            {
                Title = "Quit",
            };

            _quitMenuItem.Activated += OnQuitClickedInternal;

            Submenu.AddItem(_refreshMenuItem);
            Submenu.AddItem(_refreshAllMenuItem);
            Submenu.AddItem(NSMenuItem.SeparatorItem);
            Submenu.AddItem(_settingsMenuItem);
            Submenu.AddItem(_quitMenuItem);
        }
Example #2
0
        public DataBoundNSMenuItem(IScheduler dispatcher, MenuItem item, IReport log)
        {
            item.Menu.Do(submenu =>
                         MenuBuilder.CreateMenu(submenu, log, item.Name)
                         .ToObservable().Subscribe(t =>
                                                   Fusion.Application.MainThread.InvokeAsync(() => Submenu = t)));

            Action click = () => { };

            _subscription = Disposable.Combine
                            (
                item.Command.Action.CombineLatest(item.Name).Subscribe(cmdName =>
                                                                       dispatcher.Schedule(() =>
            {
                var cmd  = cmdName.Item1;
                var name = cmdName.Item2;
                Title    = name;
                Enabled  = cmd.HasValue;
                click    = () => log.TrySomethingBlocking(() => cmd.Do(x => x()));
                if (item.Hotkey != HotKey.None)
                {
                    KeyEquivalentModifierMask = item.Hotkey.Modifier.ToNSEventModifierMask();
                    KeyEquivalent             = item.Hotkey.Key.ToKeyEquivalent();
                }
            })),

                item.IsToggled.Subscribe(isToggled =>
                                         dispatcher.Schedule(() =>
                                                             State = isToggled ? NSCellStateValue.On : NSCellStateValue.Off)),

                Disposable.Create(() => item.Menu.Do(_ => Submenu.Dispose()))
                            );

            Activated += (s, a) => click();
        }
Example #3
0
    public void switchMenu(int type)
    {
        Menutype mt = (Menutype)type;

        switch (mt)
        {
        case Menutype.MAIN:
            Submenu s = settings.gameObject.activeInHierarchy ? (Submenu)settings :
                        (compendium.gameObject.activeInHierarchy ? (Submenu)compendium : (Submenu)controls);
            s.gameObject.SetActive(false);
            main.SetActive(true);
            break;

        case Menutype.SETTINGS:
            settings.openSubmenu();
            main.SetActive(false);
            break;

        case Menutype.COMPENDIUM:
            compendium.openSubmenu();
            main.SetActive(false);
            break;

        case Menutype.CONTROLS:
            controls.openSubmenu();
            main.SetActive(false);
            break;
        }
        currentMenu = mt;
    }
        public List <Submenu> obtenerMenu(int IdLinea)
        {
            List <Submenu> ListaMenu  = new List <Submenu>();
            Submenu        parametros = new Submenu();
            var            acceso     = from oAcceso in db.Acceso
                                        join oSubmenu in db.Submenu
                                        on oAcceso.Id_Submenu equals oSubmenu.Id
                                        where oSubmenu.Activo == 1 && oAcceso.Id_LineaNegocio == IdLinea &&
                                        oSubmenu.Controlador != "ParametrosCarga"
                                        select new
            {
                oSubmenu.Controlador,
                oSubmenu.Nombre,
                oSubmenu.Id_Menu
            };

            foreach (var elemento in acceso)
            {
                ListaMenu.Add(new Submenu
                {
                    Nombre      = elemento.Nombre,
                    Controlador = elemento.Controlador,
                    Id_Menu     = elemento.Id_Menu
                });
            }
            ListaMenu  = ListaMenu.OrderBy(x => x.Nombre).ToList();
            parametros = db.Submenu.Where(x => x.Controlador == "ParametrosCarga").SingleOrDefault();
            ListaMenu.Insert(0, parametros);
            //ListaMenu.Add(parametros);


            return(ListaMenu);
        }
Example #5
0
        public void SetSubmenu(Submenu submenu)
        {
            this.submenu = submenu;
            var rect = GetComponent <RectTransform>();

            rect.anchoredPosition = new Vector2(20, -20 - 80 * (byte)submenu);
            text.text             = StringResources.Get(submenu.ToString() + "_submenu");
        }
Example #6
0
        public static void RadioButton()
        {
            Menu    menu    = new Menu();
            Submenu submenu = new Submenu();

            menu.Elements.Click();
            submenu.RadioButton.Click();
        }
Example #7
0
        public static void TextBox()
        {
            Menu    menu    = new Menu();
            Submenu submenu = new Submenu();

            menu.Elements.Click();
            submenu.TextBox.Click();
        }
Example #8
0
        public static void CheckBoxButton()
        {
            Menu    menu    = new Menu();
            Submenu submenu = new Submenu();

            menu.Elements.Click();
            submenu.CheckBox.Click();
        }
Example #9
0
 protected override void DisposeManagedResources()
 {
     base.DisposeManagedResources();
     Command          = null;
     CommandParameter = null;
     Submenu?.Dispose();
     Submenu = null;
 }
Example #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     menu.GenerateMenu("Reports");
     Submenu.GenerateMenu("Census Hartford");
     if (!IsPostBack)
     {
         Repository.Shops.GetShopReport_cb(Drp_shop);
     }
 }
Example #11
0
 private void bt_Exit_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(Main.resManager.GetString("Confirm_Exit_Main_Menu", Main.culInfo), Main.resManager.GetString("Header_Exit_Main_Menu", Main.culInfo), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Main.Exit = true;
         menu      = Submenu.Quit;
         Close();
     }
 }
Example #12
0
        // MOUSE CLICK
        private void bt_Settings_Click(object sender, EventArgs e)
        {
            User_Settings usettingsForm = new User_Settings();

            usettingsForm.ShowDialog();
            LoadLanguage();
            menu = Submenu.NULL;
            Close();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     menu.GenerateMenu("Reports");
     Submenu.GenerateMenu("HealthBenefit");
     if (!IsPostBack)
     {
         Repository.Benefits.GetBenefits_cb(Drp_shop);
     }
 }
Example #14
0
 public Submenu Create(Submenu submenu)
 {
     using (_unitOfWork)
     {
         _db.Submenus.Add(submenu);
         _db.SaveChanges();
         return(submenu);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     menu.GenerateMenu("Reports");
     Submenu.GenerateMenu("AflacCensus");
     if (!IsPostBack)
     {
         Noreportlbl.Visible = false;
         Repository.Shops.GetShopReport_cb(Drp_shop);
     }
 }
Example #16
0
 private IEnumerable <SettingField> GetFields(Submenu submenu)
 {
     foreach (SettingField field in fields)
     {
         if (field.attribute.submenu == submenu)
         {
             yield return(field);
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        menu.GenerateMenu("Reports");
        Submenu.GenerateMenu("Percapita-Outgoing");
        if (!IsPostBack)
        {
            Percapita_Outgoing report = new Percapita_Outgoing();

            ReportViewer1.Visible = true;
            ReportViewer1.Report  = report;
        }
    }
        public ActionResult Edit(int id, FormCollection collection, HttpPostedFileBase image)
        {
            Submenu model    = Submenu.FindBy(id);
            string  path     = "";
            string  pathsave = "";

            try
            {
                if (image != null)
                {
                    if (image.ContentLength > 0)
                    {
                        DateTime _starttime = DateTime.UtcNow;
                        string   fileName   = _starttime.Ticks.ToString() + '_' + Path.GetFileName(image.FileName);


                        var file = Path.GetFullPath(Server.MapPath(@"~\Upload\submenu"));
                        if (!Directory.Exists(file))
                        {
                            Directory.CreateDirectory(file);
                        }

                        path = Path.Combine(file, fileName);
                        image.SaveAs(path);
                        pathsave = @"/Upload/submenu" + "/" + fileName;
                    }
                }

                model.name  = Request.Form["name"];
                model.kode  = Request.Form["kode"];
                model.price = float.Parse(Request.Form["price"]);

                if (pathsave != "")
                {
                    model.image = pathsave;
                }

                model.id_menu     = Int32.Parse(Request.Form["id_menu"]);
                model.id_submenu  = Int32.Parse(Request.Form["id_submenu"]);
                model.status      = Int32.Parse(Request.Form["status"]);
                model.text        = Request.Form["text"];
                model.description = Request.Form["description"];
                model.Save();
                // TODO: Add insert log
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(model));
            }
        }
Example #19
0
 public void Update(MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
 {
     if (ces.AutoHide)
     {
         ((MDMenu)Submenu).UpdateCommands();
         Hidden = Submenu.ItemArray().All(item => item.Hidden);
     }
     if (!Hidden)
     {
         MDMenu.ShowLastSeparator(ref lastSeparator);
     }
 }
Example #20
0
 public void Update(MDMenu parent, ref int index)
 {
     ((MDMenu)Submenu).UpdateCommands();
     if (ces.AutoHide)
     {
         Hidden = Submenu.ItemArray().All(item => item.Hidden);
     }
     else
     {
         Enabled = Submenu.ItemArray().Any(item => !item.Hidden);
     }
 }
Example #21
0
      private void ConstructSubMenus()
      {
          submenus = new List <Submenu>();

          Submenu s2 = new Submenu();

          s2.AddItem(new DelegateItem("Back to Main Menu", openMenu, Color.White, Color.Gray));
          s2.AddItem(new DelegateItem("Resume Game", backToGame, Color.White, Color.Gray));

          submenus.Add(s2);

          currentSubMenuIndex = 0;
      }
Example #22
0
	/// <summary>
	/// Opens the given submenu and puts the old one on a stack
	/// </summary>
	/// <param name="submenu">the submenu</param>
	public void OpenSubmenu(Submenu submenu)
	{
		openSubmenus.Peek().FoldLeft();
		openSubmenus.Push(Instantiate<SubmenuComponent>(submenus[(int)submenu]));
		openSubmenus.Peek().Initialize(this);
		openSubmenus.Peek().transform.SetParent(transform, false);

		if (UI.Instance.EventSystem.currentSelectedGameObject != null)
		{
			openSubmenus.Peek().SelectFirstButton();
		}
		openSubmenus.Peek().FlyIn();
	}
Example #23
0
        private void ConstructSubMenus()
        {
            submenus = new List <Submenu>();

            Submenu s2 = new Submenu();

            s2.AddItem(new DelegateItem("Yes", restartEverything, Color.White, Color.Gray));
            s2.AddItem(new DelegateItem("No, exit", No, Color.White, Color.Gray));

            submenus.Add(s2);

            currentSubMenuIndex = 0;
        }
Example #24
0
    public void back()
    {
        if (openSubmenu != null)
        {
            if (openSubmenu == settings)
            {
                settings.SaveSettings();
            }
            openSubmenu.gameObject.SetActive(false);
            openSubmenu = null;

            main.SetActive(true);
        }
    }
Example #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        menu.GenerateMenu("Reports");
        Submenu.GenerateMenu("Percapita-Employer");
        if (!IsPostBack)
        {
            Noreportlbl.Visible = false;

            Percapita_EmployerFile report = new Percapita_EmployerFile();

            ReportViewer1.Visible = true;
            ReportViewer1.Report  = report;
        }
    }
Example #26
0
        private void ConstructSubMenus()
        {
            submenus = new List <Submenu>();

            Submenu s2 = new Submenu();

            s2.AddItem(new ToggleItem("Music", new String[] { "On", "Off" }, (int)Globals.audioManager.Music));
            s2.AddItem(new ToggleItem("Volume", new String[] { "Low", "Medium", "High" }, (int)Globals.audioManager.Volume));
            s2.AddItem(new DelegateItem("Back", backToMain, Color.White, Color.Gray));

            submenus.Add(s2);

            currentSubMenuIndex = 0;
        }
Example #27
0
        public void GoToSubmenu(Submenu submenu)
        {
            settingsContainer.gameObject.SetActive(true);
            foreach (Transform transform in settingsContainer.transform)
            {
                Destroy(transform.gameObject);
            }

            int i = 0;

            foreach (SettingField field in GetFields(submenu))
            {
                Instantiate(settingsPrefab, settingsContainer).GetComponent <SettingNode>().SetField(field, i++);
            }
        }
Example #28
0
        public static SubmenuModel MapFromDatabase(Submenu m)
        {
            if (m == null)
            {
                return(null);
            }

            return(new SubmenuModel
            {
                Id = m.Id,
                Number = m.Number,
                Name = m.Name,
                Description = m.Description
            });
        }
        public new void Dispose()
        {
            base.Dispose();

            _refreshMenuItem.Activated    -= OnRefreshClickedInternal;
            _refreshAllMenuItem.Activated -= OnRefreshAllClickedInternal;
            _settingsMenuItem.Activated   -= OnPreferencesClickedInternal;
            _quitMenuItem.Activated       -= OnQuitClickedInternal;

            Submenu.Dispose();

            _refreshMenuItem.Dispose();
            _refreshAllMenuItem.Dispose();
            _settingsMenuItem.Dispose();
            _quitMenuItem.Dispose();
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            Submenu model = Submenu.FindBy(id);

            try
            {
                model.Delete();
                // TODO: Add delete logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(model));
            }
        }
Example #31
0
        /// <summary>
        /// Creates a new sub forum. Switches back to regular view mode.
        /// </summary>
        protected void ForumSubmit_Click(object sender, EventArgs e)
        {
            if (!IsValid)
            {
                return;
            }
            Manager.CreateForum(CurrentPageLink, ForumTitleTextBox.Text, AllowThreadsCheckBox.Checked, AllowForumsCheckBox.Checked, IconDropDown.SelectedValue);
            _evenForum = true;
            ForumList.DataBind();
            Submenu submenu = Page.FindControl <Submenu>();

            if (submenu != null)
            {
                submenu.DataBind();
            }
            SwitchView(ViewMode.ListView);
        }
Example #32
0
    void EnableSubMenu(string subMenu)
    {
        transform.gameObject.SetActive(true);
        if (subMenus != null)
        {
            for (int i = 0; i < subMenus.Count; i++)
            {
                if (subMenus[i].subMenuName == subMenu)
                {
                    activeMenu = subMenus[i];
                    activeMenu.rectTransform.gameObject.SetActive(true);
                    activeMenu.Enable();
                }
                else
                {
                    subMenus[i].rectTransform.gameObject.SetActive(false);

                }
            }
        }
    }
Example #33
0
 private void bt_Logout_Click(object sender, EventArgs e)
 {
     menu = Submenu.Logout;
     Close();
 }
Example #34
0
 // MOUSE CLICK
 private void bt_Settings_Click(object sender, EventArgs e)
 {
     User_Settings usettingsForm = new User_Settings();
     usettingsForm.ShowDialog();
     LoadLanguage();
     menu = Submenu.NULL;
     Close();
 }
Example #35
0
 private void bt_Administration_Click(object sender, EventArgs e)
 {
     Menu = Submenu.Administration;
     Close();
 }
Example #36
0
	public void OpenSubmenu(Submenu submenuToOpen)
	{
		pauseMenu.OpenSubmenu(submenuToOpen);
	}
Example #37
0
 private void bt_Exit_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(Main.resManager.GetString("Confirm_Exit_Main_Menu", Main.culInfo), Main.resManager.GetString("Header_Exit_Main_Menu", Main.culInfo), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Main.Exit = true;
         menu = Submenu.Quit;
         Close();
     }
 }
Example #38
0
        public static void DrawSubmenus(SpriteBatch sb, ref Submenu currentSubmenu, ref string mouseText, Vector2 submenuPos = default(Vector2), bool bottomCentered = false)
        {
            if (submenuPos == default(Vector2))
                submenuPos = MechmodOptions.submenuPos;

            bool flag = !submenuLock && Main.mouseLeft && Main.mouseLeftRelease;
            if (currentSubmenu != Submenu.NONE)
                mouseText = "";
            #region GODMODE
            if (currentSubmenu == Submenu.GODMODE && category == 0)
                    {

                //So we want to size the menu based on what it contains. So, we have to define the menu options before drawing the menu:
                Dictionary<string, Action> things = new Dictionary<string, Action>()
                {
                    //I almost miss JS's anonymous functions. But this is just as cool!
                    [Main.infiniteHealth ? "Infinite health enabled" : "Infinite health disabled"] = (Action)(() => Main.infiniteHealth = !Main.infiniteHealth),
                    [Main.infiniteMana ? "Infinite mana enabled" : "Infinite mana disabled"] = (Action)(() => Main.infiniteHealth = !Main.infiniteHealth),
                    ["Button label goes here"] = (Action)(() => { System.Windows.Forms.MessageBox.Show("What you want the button do do goes here!"); })
                };
                //I just remembered Terraria does calculations according to the number of categories too. This would have been much easier if I just had an `int numLabels` at the top. Oh well, this is cool. It also makes it much easier to add more basic toggles ...
                int padding = 10;
                Rectangle draw = new Rectangle((int)(submenuPos.X - padding), (int)(submenuPos.Y - (things.Count * Main.fontMouseText.LineSpacing) / 2 - padding + cogSourceRect.Height / 2f), 250 + padding * 2, (things.Count * Main.fontMouseText.LineSpacing) + padding * 2);
                if (bottomCentered)
                    draw.Y -= ((things.Count * Main.fontMouseText.LineSpacing) / 2) + padding;
                Utils.DrawInvBG(sb, draw, colors2[colorIndex] * (.8f / 0.685f));
                //										adjust the calculation for 0.8 alpha instead of 0.685
                int i = 0;
                foreach (KeyValuePair<string, Action> kvp in things)
                    {
                    Vector2 positionish = new Vector2(draw.X + draw.Width / 2, draw.Y + padding + (Main.fontMouseText.LineSpacing * i));
                    Vector2 textSize = Utils.DrawBorderString(sb, kvp.Key, positionish, oldSubmenuHover == i ? Color.Gold : Color.White, (oldSubmenuHover == i ? 1.2f : 1f), 0.5f, 0f);
                    if (new Rectangle((int)(positionish.X - textSize.X / 2), (int)(positionish.Y), (int)textSize.X, (int)textSize.Y).Contains(new Point(Main.mouseX, Main.mouseY)))
                {
                    if (flag)
                    {
                            Main.PlaySound(12, -1, -1);
                            kvp.Value.Invoke();
                    }
                        mouseText = "Enables this feature while Godmode is active.";
                        submenuHover = i;
                }
                    i++;
                }
                if (draw.Contains(new Point(Main.mouseX, Main.mouseY)))
                {
                    Main.player[Main.myPlayer].mouseInterface = true;
                }
                else if (flag && !submenuLock)
                    {
                    //close thing
                    currentSubmenu = Submenu.NONE;
                    }
                }
            #endregion
            #region HOTKEYS
            if (currentSubmenu == Submenu.HOTKEYS && category == 3)
                {
                Dictionary<string, Action> things = new Dictionary<string, Action>()
                    {
                    ["Hotkey 1: " + (setHotkey == 1 ? "_" : Main.hotkey1)] = (Action)(() => setHotkey = 0),
                    ["Hotkey 2: " + (setHotkey == 2 ? "_" : Main.hotkey2)] = (Action)(() => setHotkey = 1),
                    ["Hotkey 3: " + (setHotkey == 3 ? "_" : Main.hotkey3)] = (Action)(() => setHotkey = 2),
                    ["Hotkey 4: " + (setHotkey == 4 ? "_" : Main.hotkey4)] = (Action)(() => setHotkey = 3),
                };
                int padding = 12;
                Rectangle draw = new Rectangle((int)(submenuPos.X - padding), (int)(submenuPos.Y - (things.Count * Main.fontMouseText.LineSpacing) / 2 - padding + cogSourceRect.Height / 2f), 250 + padding * 2, (things.Count * Main.fontMouseText.LineSpacing) + padding * 2);
                if (bottomCentered)
                    draw.Y -= ((things.Count * Main.fontMouseText.LineSpacing) / 2) + padding;
                Utils.DrawInvBG(sb, draw, colors2[colorIndex] * (.8f / .685f));
                //										adjust the calculation for 0.8 alpha instead of 0.685
                int i = 0;
                foreach (KeyValuePair<string, Action> kvp in things)
                {
                    Vector2 positionish = new Vector2(draw.X + draw.Width / 2, draw.Y + padding + (Main.fontMouseText.LineSpacing * i));
                    Vector2 textSize = Utils.DrawBorderString(sb, kvp.Key, positionish, (setHotkey == i ? Color.Gold : Color.White), (oldSubmenuHover == i ? 1.2f : 1f), 0.5f, 0f);
                    if (new Rectangle((int)(positionish.X - textSize.X / 2), (int)(positionish.Y), (int)textSize.X, (int)textSize.Y).Contains(new Point(Main.mouseX, Main.mouseY)))
                {
                    if (flag)
                    {
                            Main.PlaySound(12, -1, -1);
                            kvp.Value.Invoke();
                    }
                        submenuHover = i;
                }
                    i++;
                }
                if (draw.Contains(new Point(Main.mouseX, Main.mouseY)))
                    {
                    Main.player[Main.myPlayer].mouseInterface = true;
                    }
                else if (flag)
                {
                    //close thing
                    currentSubmenu = Submenu.NONE;
                }
                if (setHotkey >= 0)
                {
                    Main.blockInput = true;
                    Keys[] pressedKeys = Main.keyState.GetPressedKeys();
                    if (pressedKeys.Length > 0)
                    {
                        string text = string.Concat(pressedKeys[0]);
                        if (text != "None")
                        {
                            if (setHotkey == 0)
                            {
                                Main.hotkey1 = text;
                            }
                            if (setHotkey == 1)
                            {
                                Main.hotkey2 = text;
                            }
                            if (setHotkey == 2)
                            {
                                Main.hotkey3 = text;
                            }
                            if (setHotkey == 3)
                            {
                                Main.hotkey4 = text;
                            }
                            Main.blockKey = pressedKeys[0];
                            Main.blockInput = false;
                            setHotkey = -1;
                        }
                    }
                }
            }
            #endregion
            #region WIREOPACITY
            if (currentSubmenu == Submenu.WIREOPACITY)
            {

                Dictionary<string, Action<float>> things = new Dictionary<string, Action<float>>()
                        {
                    ["Red wire"] = (Action<float>)(brightness => Main.redWireBrightness = brightness),
                    ["Blue wire"] = (Action<float>)(brightness => Main.blueWireBrightness = brightness),
                    ["Green wire"] = (Action<float>)(brightness => Main.greenWireBrightness = brightness),
                    ["Actuators"] = (Action<float>)(brightness => Main.actuatorBrightness = brightness)

                };
                int padding = 10;
                Rectangle draw = new Rectangle((int)(submenuPos.X - padding), (int)(submenuPos.Y - (things.Count * Main.fontMouseText.LineSpacing) / 2 - padding + cogSourceRect.Height / 2f), 250 + padding * 2, (things.Count * Main.fontMouseText.LineSpacing) + padding * 2);
                if (bottomCentered)
                    draw.Y -= ((things.Count * Main.fontMouseText.LineSpacing) / 2) + padding;
                Utils.DrawInvBG(sb, draw, colors2[colorIndex] * (.8f / 0.685f));
                //										adjust the calculation for 0.8 alpha instead of 0.685
                int i = 0;
                Console.Clear();
                foreach (KeyValuePair<string, Action<float>> kvp in things)
                        {
                    Console.WriteLine($"brightness: {Main.redWireBrightness.ToString().PadRight(6)}, notbar: {notBar}, inbar: {inBar}, hover: {submenuHover}, barLock{submenuBarLock}");

                    Vector2 positionish = new Vector2(draw.X + draw.Width / 2 - 75f, draw.Y + padding + (Main.fontMouseText.LineSpacing * i));
                    Vector2 textSize = Utils.DrawBorderString(sb, kvp.Key, positionish, oldSubmenuHover == i ? Color.Gold : Color.White, 1f, 0.5f, 0f);
                    if (new Rectangle((int)(positionish.X - textSize.X / 2), (int)(positionish.Y), (int)textSize.X, (int)textSize.Y).Contains(new Point(Main.mouseX, Main.mouseY)))
                {
                    if (flag)
                    {
                            Main.PlaySound(12, -1, -1);
                }

                        if (MechmodOptions.submenuBarLock == -1)
                    {
                            MechmodOptions.notBar = true;
                    }
                        MechmodOptions.noSound = true;
                        MechmodOptions.submenuHover = i;

                }
                    MechmodOptions.valuePosition.X = draw.X + draw.Width - padding;
                    MechmodOptions.valuePosition.Y = positionish.Y + textSize.Y * 0.5f;
                    float value = i == 0 ? Main.redWireBrightness : (i == 1 ? Main.blueWireBrightness : (i == 2 ? Main.greenWireBrightness : Main.actuatorBrightness));
                        //bit of a hack bc sliders
                    float brightness = MechmodOptions.DrawValueBar(sb, 0.5f, value);
                    if ((MechmodOptions.inBar || MechmodOptions.submenuBarLock == i) && !MechmodOptions.notBar)
                    {
                        MechmodOptions.submenuHover = i;
                        if (Main.mouseLeft && MechmodOptions.submenuBarLock == i)
                            {
                            kvp.Value.Invoke(brightness);
                        }
                    }

                    Console.WriteLine($"brightness: {brightness.ToString().PadRight(6)}, notbar: {notBar}, inbar: {inBar}, hover: {submenuHover}, barLock{submenuBarLock}");
                    i++;
                }

                if (draw.Contains(new Point(Main.mouseX, Main.mouseY)))
                    {
                    Main.player[Main.myPlayer].mouseInterface = true;
                    }
                else if (flag)
                {
                    //close thing
                    currentSubmenu = Submenu.NONE;
                    HotbarButton.submenu = -1;
                }
            }
            #endregion

            if (submenuLock && !Main.mouseLeft)
                submenuLock = false;
        }
Example #39
0
        public static void Draw(Main mainInstance, SpriteBatch sb)
        {
            string mouseText = "";
            if (Main.player[Main.myPlayer].dead && !Main.player[Main.myPlayer].ghost)
            {
                setHotkey = -1;
                MechmodOptions.Close();
                Main.playerInventory = false;
                return;
            }
            if(drawingMiscMenu)
            {
                DrawMiscMenu(sb);
                goto END;
            }
            new Vector2((float)Main.mouseX, (float)Main.mouseY); //what is this??
            bool flag = Main.mouseLeft && Main.mouseLeftRelease;
            Vector2 screenSize = new Vector2((float)Main.screenWidth, (float)Main.screenHeight);
            Vector2 menuSize = new Vector2(width, height);  //menu dimensions
            Vector2 menuPosition = screenSize / 2f - menuSize / 2f; //position lol
            int num = 20;
            int menuWidthIncrease = 0;
            MechmodOptions._GUIHover = new Rectangle((int)(menuPosition.X - (float)num), (int)(menuPosition.Y - (float)num), (int)(menuSize.X + (float)(num * 2)) + menuWidthIncrease, (int)(menuSize.Y + (float)(num * 2)));
            Utils.DrawInvBG(sb, menuPosition.X - (float)num, menuPosition.Y - (float)num, menuSize.X + (float)(num * 2) + menuWidthIncrease, menuSize.Y + (float)(num * 2), colors[colorIndex]);
            if (new Rectangle((int)menuPosition.X - num, (int)menuPosition.Y - num, (int)menuSize.X + num * 2, (int)menuSize.Y + num * 2).Contains(new Point(Main.mouseX, Main.mouseY)))
            {
                Main.player[Main.myPlayer].mouseInterface = true;
            }
            Utils.DrawInvBG(sb, menuPosition.X + (float)(num / 2), menuPosition.Y + (float)(num * 5 / 2), menuSize.X / 2f - (float)num, menuSize.Y - (float)(num * 3), colors2[colorIndex]);
            Utils.DrawInvBG(sb, menuPosition.X + menuSize.X / 2f + (float)num, menuPosition.Y + (float)(num * 5 / 2), menuSize.X / 2f - (float)(num * 3 / 2), menuSize.Y - (float)(num * 3), colors2[colorIndex]);
            Utils.DrawBorderString(sb, "Mechmod Settings", menuPosition + menuSize * new Vector2(0.5f, 0f), Color.White, 1f, 0.5f, 0f, -1);
            float num2 = 0.7f;
            float num3 = 0.8f;
            float num4 = 0.01f;
            if (MechmodOptions.oldLeftHover != MechmodOptions.leftHover && MechmodOptions.leftHover != -1)
            {
                Main.PlaySound(12, -1, -1, 1);
            }
            if (MechmodOptions.oldRightHover != MechmodOptions.rightHover && MechmodOptions.rightHover != -1)
            {
                Main.PlaySound(12, -1, -1, 1);
            }
            if (flag && MechmodOptions.rightHover != -1 && !MechmodOptions.noSound)
            {
                Main.PlaySound(12, -1, -1, 1);
            }
            if (MechmodOptions.oldSubmenuHover != MechmodOptions.submenuHover && MechmodOptions.submenuHover != -1)
            {
                Main.PlaySound(12, -1, -1);
            }
            oldSubmenuHover = submenuHover;
            submenuHover = -1;

            MechmodOptions.oldLeftHover = MechmodOptions.leftHover;
            MechmodOptions.oldRightHover = MechmodOptions.rightHover;
            MechmodOptions.noSound = false;
            int num6 = 5; //amount of categories
            Vector2 anchor = new Vector2(menuPosition.X + menuSize.X / 4f, menuPosition.Y + (float)(num * 5 / 2));
            Vector2 offset = new Vector2(0f, menuSize.Y - (float)(num * 5)) / (float)(num6 + 1);
            for (int i = 0; i <= num6; i++)
            {
                if (MechmodOptions.leftHover == i || i == MechmodOptions.category)
                {
                    MechmodOptions.leftScale[i] += num4;
                }
                else
                {
                    MechmodOptions.leftScale[i] -= num4;
                }
                if (MechmodOptions.leftScale[i] < num2)
                {
                    MechmodOptions.leftScale[i] = num2;
                }
                if (MechmodOptions.leftScale[i] > num3)
                {
                    MechmodOptions.leftScale[i] = num3;
                }
            }

            Vector2 point;

            #region categories
            MechmodOptions.leftHover = -1;
            int num7 = MechmodOptions.category;
            if (MechmodOptions.DrawLeftSide(sb, "Cheats", 0, anchor, offset, MechmodOptions.leftScale, 0.7f, 0.8f, 0.01f))
            {
                MechmodOptions.leftHover = 0;
                if (flag)
                {
                    MechmodOptions.category = 0;
                    Main.PlaySound(10, -1, -1, 1);
                }
            }
            if (MechmodOptions.DrawLeftSide(sb, "Wiring", 1, anchor, offset, MechmodOptions.leftScale, 0.7f, 0.8f, 0.01f))
            {
                MechmodOptions.leftHover = 1;
                if (flag)
                {
                    MechmodOptions.category = 1;
                    Main.PlaySound(10, -1, -1, 1);
                }
            }
            if (MechmodOptions.DrawLeftSide(sb, "Ghosts", 2, anchor, offset, MechmodOptions.leftScale, 0.7f, 0.8f, 0.01f))
            {
                MechmodOptions.leftHover = 2;
                if (flag)
                {
                    MechmodOptions.category = 2;
                    Main.PlaySound(10, -1, -1, 1);
                }
            }
            if (MechmodOptions.DrawLeftSide(sb, "Hotbar", 3, anchor, offset, MechmodOptions.leftScale, 0.7f, 0.8f, 0.01f))
            {
                MechmodOptions.leftHover = 3;
                if (flag)
                {
                    MechmodOptions.category = 3;
                    Main.PlaySound(10, -1, -1, 1);
                }
            }

            //category to reset as well?
            //Category to reset as well.
            if (MechmodOptions.DrawLeftSide(sb, "Other", 4, anchor, offset, MechmodOptions.leftScale, 0.7f, 0.8f, 0.01f))
            {
                MechmodOptions.leftHover = 4;
                if (flag)
                {
                    MechmodOptions.category = 4;
                    Main.PlaySound(10, -1, -1, 1);
                }
            }
            if (MechmodOptions.DrawLeftSide(sb, "Close menu", 5, anchor, offset, MechmodOptions.leftScale, 0.7f, 0.8f, 0.01f))
            {
                MechmodOptions.leftHover = 5;
                if (flag)
                {
                    MechmodOptions.Close();
                    Main.PlaySound(10, -1, -1, 1);
                }
            }

            if (num7 != MechmodOptions.category)
            {
                for (int j = 0; j < MechmodOptions.rightScale.Length; j++)
                {
                    MechmodOptions.rightScale[j] = 0f;
                }
            }
            int num8 = 0;
            switch (MechmodOptions.category)
            {
                case -1: //Credits/about
                    num8 = 1;
                    num2 = 1f;
                    num3 = 1.001f;//not rly needed
                    num4 = 0.001f;
                    break;
                case 0://Cheats
                    num8 = 6;           //Number of items!
                    num2 = 1f;          //scaling stuff apparently, leave as is
                    num3 = 1.001f;      //scaling stuff apparently
                    num4 = 0.001f;      //scaling stuff apparently
                    break;
                case 1://Wiring
                    num8 = 11;
                    num2 = 1.0f;
                    num3 = 1.001f;
                    num4 = 0.001f;
                    break;
                case 2://ghosts
                    num8 = 7;
                    num2 = 1f;
                    num3 = 1.001f;
                    num4 = 0.001f;
                    break;
                case 3://hotbar
                    num8 = 6;
                    num2 = 1f;
                    num3 = 1.001f;
                    num4 = 0.001f;
                    break;
                case 4:
                    num8 = Main.sunnyDay ? 7 : 6;
                    num2 = 1f;
                    num3 = 1.001f;
                    num4 = 0.001f;
                    break;
            }
            Vector2 anchor2 = new Vector2(menuPosition.X + menuSize.X * 3f / 4f, menuPosition.Y + (float)(num * 5 / 2));
            Vector2 offset2 = new Vector2(0f, menuSize.Y - (float)(num * 3)) / (float)(num8 + 1); //offset is multiplied by i?

            for (int k = 0; k < 15; k++)
            {
                if (MechmodOptions.rightLock == k || (MechmodOptions.rightHover == k && MechmodOptions.rightLock == -1))
                {
                    MechmodOptions.rightScale[k] += num4;
                }
                else
                {
                    MechmodOptions.rightScale[k] -= num4;
                }
                if (MechmodOptions.rightScale[k] < num2)
                {
                    MechmodOptions.rightScale[k] = num2;
                }
                if (MechmodOptions.rightScale[k] > num3)
                {
                    MechmodOptions.rightScale[k] = num3;
                }
            }
            MechmodOptions.inBar = false;
            MechmodOptions.rightHover = -1;
            if (!Main.mouseLeft)
            {
                MechmodOptions.rightLock = -1;
                submenuBarLock = -1;
            }
            if (MechmodOptions.rightLock == -1)
            {
                MechmodOptions.notBar = false;
            }

            #endregion
            #region About
            try
            {
                if (MechmodOptions.category == -1)
                {
                    //draw about screen

                    Color mouseTextColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor);
                    Color fivethreeColor = Color.Firebrick.MultiplyRGB(mouseTextColor);
                    Color stefnotchColor = Color.AliceBlue.MultiplyRGB(mouseTextColor); //Well, there is no color whose name starts with Bob..
                    mouseTextColor = new Color(Main.mouseTextColor / 3 + 100, Main.mouseTextColor / 3 + 100, Main.mouseTextColor / 3 + 100);

                    // ;)
                    string[] data =
                    {
                    "10001011100110100101000100111001110",
                    "11011010001000100101101101000101001",
                    "10101011101000111101010101000101001",
                    "10001010001000100101000101000101001",
                    "10001011100110100101000100111001110",
                };
                    int i = 0;
                    int j = 0;
                    int xmult = 8;
                    int ymult = 10;
                    List<Vector2> coords = new List<Vector2>();
                    Texture2D party = Main.itemTexture[1344];
                    foreach (string s in data)
                    {
                        foreach (char c in s)
                        {
                            if (c == '1')
                                coords.Add(new Vector2(i * xmult, j * ymult));
                            i++;
                        }
                        j++;
                        i = 0;
                    }
                    Vector2 partyOrigin = new Vector2(party.Width / 2, party.Height / 2);
                    Vector2 basePosition = new Vector2(anchor2.X - 140, anchor2.Y + 8) + partyOrigin;
                    float scale = 0.8f;
                    foreach (Vector2 coordinate in coords)
                    {
                        sb.Draw(party, coordinate + basePosition, null, Color.White, cogRotation, partyOrigin, scale, SpriteEffects.None, 0f);
                    }
                    cogRotation += .01f;

                    Vector2 by = Main.fontMouseText.MeasureString("by");
                    Vector2 stefnotch = Main.fontMouseText.MeasureString("stefnotch");
                    Vector2 and = Main.fontMouseText.MeasureString("and");
                    Vector2 fivethree = Main.fontMouseText.MeasureString("five--three");
                    float smallScale = 1.2f;
                    float largeSale = 1.8f;
                    float padding = 6f;
                    Vector2 pos = new Vector2(anchor2.X, anchor2.Y + 50 * 1.5f + padding * 4);
                    Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "by", pos.X, pos.Y, Color.White.MultiplyRGB(mouseTextColor), Color.Black, by / 2, smallScale);
                    pos.Y += (by.Y * smallScale) + padding;
                    Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "stefnotch", pos.X, pos.Y, stefnotchColor, Color.CadetBlue, stefnotch / 2, largeSale);
                    pos.Y += (stefnotch.Y);
                    Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "and", pos.X, pos.Y, Color.White.MultiplyRGB(mouseTextColor), Color.Black, and / 2, smallScale);
                    pos.Y += (and.Y * smallScale) + padding;
                    Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "five--three", pos.X, pos.Y, fivethreeColor, Color.Goldenrod, fivethree / 2, largeSale); //I dont know what these two colors are but they sound nice
                    pos.Y += (fivethree.Y);
                    //Utils.DrawBorderStringFourWay(sb, Main.fontCombatText[1], "Mechmod", anchor2.X, anchor2.Y + 40, Color.Gold, Color.RosyBrown, Main.fontCombatText[1].MeasureString("Mechmod") / 2);
                    pos.Y += 30;
                    /*

                    float bottom = (menuPosition.Y + 50) + (menuSize.Y - 60);
                    int rwidth = 220;
                    int rheight = 110;
                    Rectangle box = new Rectangle((int)anchor2.X - rwidth/2, (int)bottom - 20 - rheight, rwidth, rheight);
                    int maxTransition = 100;
                    if (easter && (transitionStage <= maxTransition))
                    {
                        transitionStage++;
                    }

                    Texture2D cogTexture = Main.itemTexture[1344];
                    Texture2D redWrenchTexture = Main.itemTexture[509];
                    Texture2D blueWrenchTexture = Main.itemTexture[850];
                    Vector2 wrenchOrigin = redWrenchTexture.Bounds.Size();
                    Vector2 cogOrigin = cogTexture.Bounds.Size()/2f;

                    int cogAlpha = 255;
                    float redWrenchRotation = -0.751f; //(tani(28/30)
                    float blueWrenchRotation = -0.751f;
                    float wrenchScale = 1f;
                    if (transitionStage != 101)
                    {
                        cogPosition = box.Center.ToVector2();// i cry evrtime .....                  new Vector2(anchor2.X - ((92 * 1.5f) / 2) + 126, anchor2.Y + 4 + 31);
                        cogAlpha = (int)(transitionStage * 2.55f);

                        float redWrenchStartingRotation = -0.82f;
                        float blueWrenchStartingRotation = -0.66f;
                        float wrenchDesiredRotation = -0.751f;
                        Vector2 redWrenchStartingPosition = new Vector2(pos.X - 10, pos.Y);
                        Vector2 blueWrenchStartingPosition = new Vector2(pos.X + 10, pos.Y);

                        Vector2 redWrenchDesiredPosition = new Vector2(box.X - 4, box.Center.Y + 20.52f);
                        Vector2 blueWrenchDesiredPosition = new Vector2(box.Right + 4, box.Center.Y - 20.52f);

                        wrenchScale = 1.5f - (.05f * transitionStage);

                        redWrenchPos = (((redWrenchDesiredPosition - redWrenchStartingPosition) / maxTransition) * transitionStage) + redWrenchStartingPosition;
                        blueWrenchPos = (((blueWrenchDesiredPosition - blueWrenchStartingPosition) / maxTransition) * transitionStage) + blueWrenchStartingPosition;
                        redWrenchRotation = (((wrenchDesiredRotation - redWrenchStartingRotation) / maxTransition) * transitionStage) + redWrenchStartingRotation;
                        blueWrenchRotation = (((wrenchDesiredRotation - blueWrenchStartingRotation) / maxTransition) * transitionStage) + blueWrenchStartingRotation;

                        sb.Draw(Main.magicPixel, new Rectangle((int)redWrenchDesiredPosition.X - 2, (int)redWrenchDesiredPosition.Y - 2, 4, 4), Color.HotPink);
                        sb.Draw(Main.magicPixel, new Rectangle((int)blueWrenchDesiredPosition.X - 2, (int)blueWrenchDesiredPosition.Y - 2, 4, 4), Color.HotPink);
                        sb.Draw(Main.magicPixel, new Rectangle((int)redWrenchStartingPosition.X - 2, (int)redWrenchStartingPosition.Y - 2, 4, 4), Color.ForestGreen);
                        sb.Draw(Main.magicPixel, new Rectangle((int)blueWrenchStartingPosition.X - 2, (int)blueWrenchStartingPosition.Y - 2, 4, 4), Color.ForestGreen);

                        cogVelocity = new Vector2(2);
                    }

                    else {
                        if (Main.keyState.IsKeyDown(Keys.Up))
                        {
                            redWrenchPos.Y--;
                        }
                        if (Main.keyState.IsKeyDown(Keys.Down))
                        {
                            redWrenchPos.Y++;
                        }

                        if (redWrenchPos.Y - 21 < box.Top)
                        { redWrenchPos.Y = box.Top + 21; }
                        if (redWrenchPos.Y + 21 > box.Bottom)
                        { redWrenchPos.Y = box.Bottom - 21; }

                        if (cogPosition.Y < box.Top || cogPosition.Y > box.Bottom)
                            cogVelocity.Y = -cogVelocity.Y;
                        if (cogPosition.Y < box.Left)
                        {

                        }
                        if(cogPosition.X > box.Right)
                        {

                        }

                        Rectangle redRectangle = new Rectangle((int)redWrenchPos.X + 16, (int)redWrenchPos.Y - 21, 6, 42);
                        Rectangle blueRectangle = new Rectangle((int)blueWrenchPos.X + 20, (int)blueWrenchPos.Y - 21, 6, 42);
                        drawRectangle(redRectangle, sb);
                        drawRectangle(blueRectangle, sb);

                        if(redRectangle.Contains(cogPosition.ToPoint()))
                        {
                            cogVelocity.X = 2;
                        }
                        if(blueRectangle.Contains(cogPosition.ToPoint()))
                        {
                            cogVelocity.X = -2;
                        }
                        cogPosition += cogVelocity;
                    }

                    sb.Draw(redWrenchTexture, redWrenchPos, null, Color.White, redWrenchRotation, default(Vector2), wrenchScale, 0, 0);
                    sb.Draw(blueWrenchTexture, blueWrenchPos, null, Color.White, blueWrenchRotation, default(Vector2), wrenchScale, 0, 0);
                    sb.Draw(cogTexture, cogPosition, null, new Color(cogAlpha, cogAlpha, cogAlpha, cogAlpha), cogRotation*10, cogOrigin, 1f, 0, 0f);

                    drawRectangle(box, sb);

                    if (flag && box.Contains(Main.mouseX, Main.mouseY))
                    {
                        easter = true;
                        cogPosition = box.Center.ToVector2();
                        cogVelocity = new Vector2(2);
                        Main.sunnyDay = true;
                    }

                    //get to 7 points
                    //on win: draw sunglasses on all npc's
                    //armor_head_12
                    */
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
            }
            #endregion
            #region Cheats
            if (MechmodOptions.category == 0)
            {
                int num9 = 0;
                //anchor2.X += 70f;//This adjusts the position for slider bars,
                //We don't want to do this.
                if (MechmodOptions.DrawRightSide(sb, Main.infiniteWire ? "Infinite wire enabled" : "Infinite wire disabled", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.infiniteWire = !Main.infiniteWire;
                    }
                    mouseText = (Main.infiniteWire ? "Wrenches will not require or consume any wire." : "Wrenches will use wire from your inventory.") + "\nWhen enabled, wire cutters will not drop any wire.";
                }
                num9++;  //Do this between elements
                if (MechmodOptions.DrawRightSide(sb, Main.infiniteActuators ? "Infinite actuators enabled" : "Infinite actuators disabled", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.infiniteActuators = !Main.infiniteActuators;
                    }
                    mouseText = (Main.infiniteActuators ? "Actuators will not be consumed when placed." : "Actuators will be consumed when placecd.") + "\nWhen enabled, wire cutters will not drop any actuators.";
                }
                num9++;
                if (MechmodOptions.DrawRightSide(sb, Main.godmode ? "Godmode enabled" : "Godmode disabled", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.godmode = !Main.godmode;
                    }
                    mouseText = "When enabled, you will walk straight through enemies without being hit, have infinite health and mana";
                }
                //                      righthand side of the menu - width of the texture - a bit more padding,   yposition of text middle - half textureheight
                point = new Vector2(menuPosition.X + menuSize.X - (num * 3f / 2f) - cogSourceRect.Width - 2, anchor2.Y + offset2.Y*(1+num9) + Main.fontMouseText.LineSpacing/2f - cogSourceRect.Height*1.5f).Floor();
                //draw triangle
                Color color = Color.White;
                Rectangle area = new Rectangle((int)point.X - buttonLeniency, (int)point.Y - buttonLeniency, cogSourceRect.Width + buttonLeniency * 2, cogSourceRect.Height + buttonLeniency * 2);
                drawRectangle(area, sb);
                if (area.Contains(new Point(Main.mouseX, Main.mouseY)))
                {
                    color = Color.Gold;
                    if (flag)
                    {
                        currentSubmenu = Submenu.GODMODE;
                        submenuLock = true;
                        submenuPos = point - new Vector2(0, cogSourceRect.Height/2);
                    }
                }
                sb.Draw(UITextures, point, cogSourceRect, color, 0f, Vector2.Zero, 1f, 0, 0);
                num9++;
                if (MechmodOptions.DrawRightSide(sb, Main.infiniteHealth ? "Infinite health enabled" : "Infinite health disabled", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.infiniteHealth = !Main.infiniteHealth;
                    }
                    mouseText = "When enabled, you will not take any damage.";
                }
                num9++;/*
                if (MechmodOptions.DrawRightSide(sb, Main.infiniteMana ? "Infinite mana enabled" : "Infinite mana disabled", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.infiniteMana = !Main.infiniteMana;
                    }
                    mouseText = "When enabled, no mana will be used.";
                }
                num9++;*/
                if (MechmodOptions.DrawRightSide(sb, !Main.placingLimits ? "No placing limits" : "Normal placing limits", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.placingLimits = !Main.placingLimits;
                    }
                    mouseText = "When enabled, you can place blocks anywhere.";
                }
                num9++;
                anchor2.X -= 70f;
                if (MechmodOptions.DrawRightSide(sb, string.Concat(new object[]
                {
                    "UFO speed:",
                    " ",
                    Math.Round((double)(Main.UFOSpeed * 100f)),
                    "%"
                }), num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), new Color(255, 128, 128)))
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.noSound = true;
                    MechmodOptions.rightHover = num9;
                }
                MechmodOptions.valuePosition.X = menuPosition.X + menuSize.X - (float)(num / 2) - 20f;
                MechmodOptions.valuePosition.Y = MechmodOptions.valuePosition.Y - 3f;
                float ufospeed = MechmodOptions.DrawValueBar(sb, 0.75f, Main.UFOSpeed, 5f);
                if ((MechmodOptions.inBar || MechmodOptions.rightLock == num9) && !MechmodOptions.notBar)
                {
                    MechmodOptions.rightHover = num9;
                    if (Main.mouseLeft && MechmodOptions.rightLock == num9)
                    {
                        Main.UFOSpeed = ufospeed;
                    }
                    mouseText = "Modifies the speed of the alien UFO mount.";
                }
                if ((float)Main.mouseX > menuPosition.X + menuSize.X * 2f / 3f + (float)num && (float)Main.mouseX < MechmodOptions.valuePosition.X + 3.75f && (float)Main.mouseY > MechmodOptions.valuePosition.Y - 10f && (float)Main.mouseY <= MechmodOptions.valuePosition.Y + 10f)
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.rightHover = num9;
                }
                anchor2.X += 70f;
                num9++;
                if (MechmodOptions.DrawRightSide(sb, "Reset UFO speed", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), Color.LightGray))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.UFOSpeed = 1f;
                    }
                }
                num9++;
            }
            #endregion
            #region Wiring
            if (MechmodOptions.category == 1)
            {
                int num10 = 0;
                if (MechmodOptions.DrawRightSide(sb, Main.brightRedWire ? "Red wire unaffected by light" : "Red wire affected by light", num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.brightRedWire = !Main.brightRedWire;
                    }
                    mouseText = "This setting dictates whether red wire will\nshow regardless of light level.";
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, Main.brightBlueWire ? "Blue wire unaffected by light" : "Blue wire affected by light", num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.brightBlueWire = !Main.brightBlueWire;
                    }
                    mouseText = "This setting dictates whether blue wire will\nshow regardless of light level.";
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, Main.brightGreenWire ? "Green wire unaffected by light" : "Green wire affected by light", num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.brightGreenWire = !Main.brightGreenWire; //todo Main.instance.MouseText("This dictates whether this color of wire will ignore lighting.")
                    }
                    mouseText = "This setting dictates whether green wire will\nshow regardless of light level.";
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, Main.brightActuators ? "Actuators unaffected by light" : "Actuators affected by light", num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.brightActuators = !Main.brightActuators;
                    }
                    mouseText = "This setting dictates whether actuators will\nshow regardless of light level.";
                }
                num10++; //add seperator?
                         //Add seperator.
                MechmodOptions.DrawRightSide(sb, "-Wire opacity-", num10, anchor2, offset2, MechmodOptions.rightScale[num10], 0.9f, default(Color));
                num10++;

                anchor2.X -= 70f;
                if (MechmodOptions.DrawRightSide(sb, string.Concat(new object[]
                {
                    "Red:",
                    " ",
                    Math.Round((double)(Main.redWireBrightness * 100f)),
                    "%"
                }), num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), new Color(255, 128, 128)))
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.noSound = true;
                    MechmodOptions.rightHover = num10;
                }
                MechmodOptions.valuePosition.X = menuPosition.X + menuSize.X - (float)(num / 2) - 20f;
                MechmodOptions.valuePosition.Y = MechmodOptions.valuePosition.Y - 3f;
                float redBrightness = MechmodOptions.DrawValueBar(sb, 0.75f, Main.redWireBrightness);
                if ((MechmodOptions.inBar || MechmodOptions.rightLock == num10) && !MechmodOptions.notBar)
                {
                    MechmodOptions.rightHover = num10;
                    if (Main.mouseLeft && MechmodOptions.rightLock == num10)
                    {
                        Main.redWireBrightness = redBrightness;
                    }
                    mouseText = "The opactiy of red wire.";
                }
                if ((float)Main.mouseX > menuPosition.X + menuSize.X * 2f / 3f + (float)num && (float)Main.mouseX < MechmodOptions.valuePosition.X + 3.75f && (float)Main.mouseY > MechmodOptions.valuePosition.Y - 10f && (float)Main.mouseY <= MechmodOptions.valuePosition.Y + 10f)
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.rightHover = num10;
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, string.Concat(new object[]
                {
                    "Blue:",
                    " ",
                    Math.Round((double)(Main.blueWireBrightness * 100f)),
                    "%"
                }), num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), new Color(128, 128, 255)))
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.noSound = true;
                    MechmodOptions.rightHover = num10;
                }
                MechmodOptions.valuePosition.X = menuPosition.X + menuSize.X - (float)(num / 2) - 20f;
                MechmodOptions.valuePosition.Y = MechmodOptions.valuePosition.Y - 3f;
                float blueBrightness = MechmodOptions.DrawValueBar(sb, 0.75f, Main.blueWireBrightness);
                if ((MechmodOptions.inBar || MechmodOptions.rightLock == num10) && !MechmodOptions.notBar)
                {
                    MechmodOptions.rightHover = num10;
                    if (Main.mouseLeft && MechmodOptions.rightLock == num10)
                    {
                        Main.blueWireBrightness = blueBrightness;
                    }
                    mouseText = "The opacity of blue wire.";
                }
                if ((float)Main.mouseX > menuPosition.X + menuSize.X * 2f / 3f + (float)num && (float)Main.mouseX < MechmodOptions.valuePosition.X + 3.75f && (float)Main.mouseY > MechmodOptions.valuePosition.Y - 10f && (float)Main.mouseY <= MechmodOptions.valuePosition.Y + 10f)
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.rightHover = num10;
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, string.Concat(new object[]
                {
                    "Green:",
                    " ",
                    Math.Round((double)(Main.greenWireBrightness * 100f)),
                    "%"
                }), num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), new Color(128, 255, 128)))
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.noSound = true;
                    MechmodOptions.rightHover = num10;
                }
                MechmodOptions.valuePosition.X = menuPosition.X + menuSize.X - (float)(num / 2) - 20f;
                MechmodOptions.valuePosition.Y = MechmodOptions.valuePosition.Y - 3f;
                float greenBrightness = MechmodOptions.DrawValueBar(sb, 0.75f, Main.greenWireBrightness);
                if ((MechmodOptions.inBar || MechmodOptions.rightLock == num10) && !MechmodOptions.notBar)
                {
                    MechmodOptions.rightHover = num10;
                    if (Main.mouseLeft && MechmodOptions.rightLock == num10)
                    {
                        Main.greenWireBrightness = greenBrightness;
                    }
                    mouseText = "The opacity of green wire.";
                }
                if ((float)Main.mouseX > menuPosition.X + menuSize.X * 2f / 3f + (float)num && (float)Main.mouseX < MechmodOptions.valuePosition.X + 3.75f && (float)Main.mouseY > MechmodOptions.valuePosition.Y - 10f && (float)Main.mouseY <= MechmodOptions.valuePosition.Y + 10f)
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.rightHover = num10;
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, string.Concat(new object[]
                {
                    "Actuators:",
                    " ",
                    Math.Round((double)(Main.actuatorBrightness * 100f)),
                    "%"
                }), num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), new Color(255, 255, 128)))
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.noSound = true;
                    MechmodOptions.rightHover = num10;
                }
                // This is really weird.
                MechmodOptions.valuePosition.X = menuPosition.X + menuSize.X - (float)(num / 2) - 20f;
                MechmodOptions.valuePosition.Y = MechmodOptions.valuePosition.Y - 3f;
                float actuatorBright = MechmodOptions.DrawValueBar(sb, 0.75f, Main.actuatorBrightness);
                if ((MechmodOptions.inBar || MechmodOptions.rightLock == num10) && !MechmodOptions.notBar)
                {
                    MechmodOptions.rightHover = num10;
                    if (Main.mouseLeft && MechmodOptions.rightLock == num10)
                    {
                        Main.actuatorBrightness = actuatorBright;
                    }
                    mouseText = "The brightness of actuators.";
                }
                if ((float)Main.mouseX > menuPosition.X + menuSize.X * 2f / 3f + (float)num && (float)Main.mouseX < MechmodOptions.valuePosition.X + 3.75f && (float)Main.mouseY > MechmodOptions.valuePosition.Y - 10f && (float)Main.mouseY <= MechmodOptions.valuePosition.Y + 10f)
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.rightHover = num10;
                }
                anchor2.X += 70f;
                num10++;

                if (MechmodOptions.DrawRightSide(sb, Main.alwaysShowWires ? "Always show wires" : "Conditionally show wires", num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.alwaysShowWires = !Main.alwaysShowWires;
                    }
                    mouseText = Main.alwaysShowWires ? "Wires will show regardless of the currently selected item." : "Wires will only show when a mechanical item is selected.";
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, Main.wrenchHighlight ? "Wrenches highlight wire" : "Wrenches don't highlight wire", num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.wrenchHighlight = !Main.wrenchHighlight;
                    }
                    mouseText = "If enabled, chains of wire under the mouse will be highlighted if the player is holding a wrench of the respective color.\nThis feature is otherwise available with the Mechanical Ruler, bought from the Mechanic.";
                }
                num10++;
                /*
                if (MechmodOptions.DrawRightSide(sb, Lang.menu[59 + Main.qaStyle], num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.qaStyle++;
                        if (Main.qaStyle > 3)
                        {
                            Main.qaStyle = 0;
                        }
                    }
                }
                num10++;
                if (MechmodOptions.DrawRightSide(sb, Main.owBack ? Lang.menu[100] : Lang.menu[101], num10, anchor2, offset2, MechmodOptions.rightScale[num10], (MechmodOptions.rightScale[num10] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num10;
                    if (flag)
                    {
                        Main.owBack = !Main.owBack;
                    }
                }
                num10++;*/
            }
            #endregion
            #region Ghosts
            if (MechmodOptions.category == 2)
            {
                int num9 = 0; //lol we can leave this here

                //anchor2.X += 70f;//This adjusts the position for slider bars,
                //We don't want to do this.
                if (MechmodOptions.DrawRightSide(sb, Main.showDummyGhosts ? "Dummy ghosts enabled" : "Dummy ghosts disabled", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.showDummyGhosts = !Main.showDummyGhosts;
                    }
                    mouseText = (Main.showDummyGhosts ? "Dummy 'ghosts' will be shown." : "Dummy 'ghosts' are hidden.");
                }
                num9++;  //Do this between elements
                if (MechmodOptions.DrawRightSide(sb, Main.dummyGhostBright ? "Ghosts are unaffected by light" : "Ghosts are affected by light", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.dummyGhostBright = !Main.dummyGhostBright;
                    }
                    mouseText = Main.dummyGhostBright ? "Dummy ghosts will be shown regardless of the light level in their area." : "Dummy ghosts will be darkened according to nearby light levels.";
                }
                num9++;
                if (MechmodOptions.DrawRightSide(sb, Main.dummyGhostOutline ? "Dummy ghosts outlined in red" : "Dummy ghosts not outlined", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.dummyGhostOutline = !Main.dummyGhostOutline;
                    }
                    mouseText = "When enabled, dummy ghosts will be shown with a thick red outline.";
                }
                num9++;
                if (MechmodOptions.DrawRightSide(sb, Main.alwaysSpawnDummies ? "Dummies spawn when activated" : "Dummies spawn on world load", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.alwaysSpawnDummies = !Main.alwaysSpawnDummies;
                    }
                    mouseText = "In vanilla Terraria, dummies only spawn when a player enters a 100x100 block rectangle around them." + "\n" + "If this setting is enabled, they will spawn regardless of the player position.";
                }

                num9++;
                if (MechmodOptions.DrawRightSide(sb, "Kill wayward ghosts", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), Color.LightGray))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        MechmodOptions.Close();
                        Main.playerInventory = false;
                        Main.NewText(Main.killDummies().ToString() + " rogues killed.", 64, 255, 64, true);
                    }
                    mouseText = "When dummies are moved with TEdit, the ghosts remain in the save file." + "\n" + " These rogue ghosts are unkillable, unmovable, and can not get hit by projectiles." + "\n" + "Click here to attempt to remove them.";
                }
                num9++;
                anchor2.X -= 70f;
                if (MechmodOptions.DrawRightSide(sb, string.Concat(new object[]
                {
                    "Brightness",
                    " ",
                    Math.Round((double)(Main.dummyGhostBrightness * 100f)),
                    "%"
                }), num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2), new Color(255, 128, 128)))
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.noSound = true;
                    MechmodOptions.rightHover = num9;
                }
                MechmodOptions.valuePosition.X = menuPosition.X + menuSize.X - (float)(num / 2) - 20f;
                MechmodOptions.valuePosition.Y = MechmodOptions.valuePosition.Y - 3f;
                float brightness = MechmodOptions.DrawValueBar(sb, 0.75f, Main.dummyGhostBrightness);
                if ((MechmodOptions.inBar || MechmodOptions.rightLock == num9) && !MechmodOptions.notBar)
                {
                    MechmodOptions.rightHover = num9;
                    if (Main.mouseLeft && MechmodOptions.rightLock == num9)
                    {
                        Main.dummyGhostBrightness = brightness;
                    }
                    mouseText = "The opacity of dummy ghosts.";
                }
                if ((float)Main.mouseX > menuPosition.X + menuSize.X * 2f / 3f + (float)num && (float)Main.mouseX < MechmodOptions.valuePosition.X + 3.75f && (float)Main.mouseY > MechmodOptions.valuePosition.Y - 10f && (float)Main.mouseY <= MechmodOptions.valuePosition.Y + 10f)
                {
                    if (MechmodOptions.rightLock == -1)
                    {
                        MechmodOptions.notBar = true;
                    }
                    MechmodOptions.rightHover = num9;
                }
                anchor2.X += 70f;
                num9++;
                if (MechmodOptions.DrawRightSide(sb, Main.showDummyID ? "Show dummy IDs" : "Hide dummy IDs", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.showDummyID = !Main.showDummyID;
                    }
                    mouseText = "Show/hide the internal NPC IDs for each dummy.";
                }
                num9++;
                if (MechmodOptions.DrawRightSide(sb, Main.dummyFeet ? "Show ghost feet" : "Hide ghost feet", num9, anchor2, offset2, MechmodOptions.rightScale[num9], (MechmodOptions.rightScale[num9] - num2) / (num3 - num2)))
                {
                    MechmodOptions.rightHover = num9;
                    if (flag)
                    {
                        Main.dummyFeet = !Main.dummyFeet;
                    }
                }
                num9++;
            }

            #endregion
            #region Hotbar
            if (MechmodOptions.category == 3)
            {
                int num13 = 0;
                //anchor2.X -= 30f;
                if (MechmodOptions.DrawRightSide(sb, "Hotkeys", num13, anchor2, offset2, MechmodOptions.rightScale[num13], (MechmodOptions.rightScale[num13] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num13;
                    if (flag)
                    {
                        currentSubmenu = Submenu.HOTKEYS;
                        submenuLock = true;
                        submenuPos = new Vector2(menuPosition.X + menuSize.X - (num * 3f / 2f) - cogSourceRect.Width - 2, anchor2.Y + offset2.Y * (1 + num13) + Main.fontMouseText.LineSpacing / 2f - cogSourceRect.Height * 1.5f) - new Vector2(0, cogSourceRect.Height / 2);
                    }
                    mouseText = "The first 4 hotbar slots are mapped to hotkeys. Click to rebind them.";
                }
                num13++;
                if (MechmodOptions.DrawRightSide(sb, "Misc toggles", num13, anchor2, offset2, MechmodOptions.rightScale[num13], (MechmodOptions.rightScale[num13] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num13;
                    if (flag)
                    {
                        drawingMiscMenu = true;
                    }
                    mouseText = "Open a menu of miscellaneous toggles.";
                }
                num13++;
                if (MechmodOptions.DrawRightSide(sb, "Clear Hotbar", num13, anchor2, offset2, MechmodOptions.rightScale[num13], (MechmodOptions.rightScale[num13] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num13;
                    if (flag)
                    {
                        HotbarButton.RemoveAll();
                    }
                    mouseText = "Remove all buttons from the hotbar.";
                }
                num13++;
                }
            #endregion
            #region Other
            if (MechmodOptions.category == 4)
                    {
                int num17 = 0;

                if (MechmodOptions.DrawRightSide(sb, "Reset all Mechmod settings", num17, anchor2, offset2, MechmodOptions.rightScale[num17], (MechmodOptions.rightScale[num17] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num17;
                    if (flag)
                    {
                        if (resetConfirm)
                    {
                            ConfigHandler.configFileSetup(true);
                            resetConfirm = false;
                            return;
                }
                        else
                    {
                            resetConfirm = true;
                            flag = false;
                }

                    }
                    mouseText = "Once reset, settings are not recoverable." + "\n" + (resetConfirm ? "Click again to confirm." : "Are you sure?");
                }
                num17++;  //Do this between elements
                if (MechmodOptions.DrawRightSide(sb, Main.showMechmodSettingButton ? "Inventory button enabled" : "Inventory button hidden", num17, anchor2, offset2, MechmodOptions.rightScale[num17], (MechmodOptions.rightScale[num17] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num17;
                    if (flag)
                    {
                        Main.showMechmodSettingButton = !Main.showMechmodSettingButton;
                    }
                    mouseText = "Shows a (glitchy) button on the inventory menu." + "\n" + "The button will overlap the defence icon sometimes, so it is disabled by default";
                }
                num17++;
                if (MechmodOptions.DrawRightSide(sb, "Color: " + (colorIndex + 1).ToString(), num17, anchor2, offset2, MechmodOptions.rightScale[num17], (MechmodOptions.rightScale[num17] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num17;
                    if (flag)
                    {
                        colorIndex++;
                        if (colorIndex == colors.Length)
                            colorIndex = 0;
                    }
                    mouseText = "Changes the menu color. Default: 1";
                }
                num17++;
                if (MechmodOptions.DrawRightSide(sb, "Hotbar Color: " + (HotbarButton.hcolorIndex + 1).ToString(), num17, anchor2, offset2, MechmodOptions.rightScale[num17], (MechmodOptions.rightScale[num17] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num17;
                    if (flag)
                    {
                        HotbarButton.hcolorIndex++;
                        if (HotbarButton.hcolorIndex == colors.Length)
                            HotbarButton.hcolorIndex = 0;
                    }
                    mouseText = "Changes the hotbar color. Default: 1";
                }
                num17++;
                if (MechmodOptions.DrawRightSide(sb, !Main.clouds ? "No clouds" : "Clouds", num17, anchor2, offset2, MechmodOptions.rightScale[num17], (MechmodOptions.rightScale[num17] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num17;
                    if (flag)
                    {
                        Main.clouds = !Main.clouds;
                        if (!Main.clouds) //If there aren't any clouds
                {
                            for (int i = 0; i < 200; i++)
                    {
                                Main.cloud[i].active = false;
                    }
                }
                    }
                    mouseText = "Toggle all the clouds!";
                }
                num17++;
                if (MechmodOptions.DrawRightSide(sb, Main.TPParticles ? "Teleporter particles visible" : "Teleporter particles invisible", num17, anchor2, offset2, MechmodOptions.rightScale[num17], (MechmodOptions.rightScale[num17] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num17;
                    if (flag)
                    {
                        Main.TPParticles = !Main.TPParticles;
                    }
                    mouseText = "This setting dictates the Teleporter particles visibility.";
                }
                num17++;
                if (Main.sunnyDay && MechmodOptions.DrawRightSide(sb, "Disable easter egg", num17, anchor2, offset2, MechmodOptions.rightScale[num17], (MechmodOptions.rightScale[num17] - num2) / (num3 - num2), default(Color)))
                {
                    MechmodOptions.rightHover = num17;
                    if (flag)
                    {
                        Main.sunnyDay = false;
                }
                    mouseText = "Will need to be re-unlocked.";
                    }
                num17++;
                }
            #endregion
            #region Submenu Overlays
            DrawSubmenus(sb, ref currentSubmenu, ref mouseText);
            #endregion
            if (MechmodOptions.rightHover != -1 && MechmodOptions.rightLock == -1)
                    {
                MechmodOptions.rightLock = MechmodOptions.rightHover;
                }
            if (MechmodOptions.submenuHover != -1 && MechmodOptions.submenuBarLock == -1)
                {
                MechmodOptions.submenuBarLock = MechmodOptions.submenuHover;
                }
            if (resetConfirm && flag)
                    {
                resetConfirm = false;
                }
            END:
            Main.instance.GUIBarsDraw();
            Main.instance.DrawMouseOver();
            Vector2 value4 = Main.DrawThickCursor(false);
            sb.Draw(Main.cursorTextures[0], new Vector2((float)Main.mouseX, (float)Main.mouseY) + value4 + Vector2.One, null, new Color((int)((float)Main.cursorColor.R * 0.2f), (int)((float)Main.cursorColor.G * 0.2f), (int)((float)Main.cursorColor.B * 0.2f), (int)((float)Main.cursorColor.A * 0.5f)), 0f, default(Vector2), Main.cursorScale * 1.1f, SpriteEffects.None, 0f);
            sb.Draw(Main.cursorTextures[0], new Vector2((float)Main.mouseX, (float)Main.mouseY) + value4, null, Main.cursorColor, 0f, default(Vector2), Main.cursorScale, SpriteEffects.None, 0f);
            Main.mouseText = false;
            if(mouseText != "")
                    {
                //Gotta do it here, otherwise text in following elements draws over it ( looks nasty )
                Main.instance.MouseText(mouseText);
                Main.mouseText = true;
                    }
        }
Example #40
0
 public static void Open()
 {
     Main.playerInventory = false;
     Main.editChest = false;
     Main.npcChatText = "";
     Main.PlaySound(10, -1, -1, 1);
     Main.isDrawingMechmodInterface = true;
     MechmodOptions.category = -1;
     for (int i = 0; i < MechmodOptions.leftScale.Length; i++)
     {
         MechmodOptions.leftScale[i] = 0f;
     }
     for (int j = 0; j < MechmodOptions.rightScale.Length; j++)
     {
         MechmodOptions.rightScale[j] = 0f;
     }
     MechmodOptions.leftHover = -1;
     MechmodOptions.rightHover = -1;
     MechmodOptions.oldLeftHover = -1;
     MechmodOptions.oldRightHover = -1;
     MechmodOptions.rightLock = -1;
     MechmodOptions.inBar = false;
     MechmodOptions.notBar = false;
     MechmodOptions.noSound = false;
     currentSubmenu = Submenu.NONE;
     submenuHover = -1;
     submenuBarLock = -1;
     drawingMiscMenu = false;
 }
Example #41
0
	/// <summary>
	/// Checks if the submenu is open
	/// </summary>
	/// <param name="submenu">the submenu to check</param>
	/// <returns>true, if open</returns>
	public bool IsSubmenuOpen(Submenu submenu)
	{
		return openSubmenus.Contains(submenus[(int)submenu]);
	}
Example #42
0
 void OnEnable()
 {
     if (activeMenu != null)
     {
         activeMenu.rectTransform.gameObject.SetActive(false);
     }
     activeMenu = null;
     if (manager != null)
     {
         if (manager.workType.subMenu != null && manager.workType.subMenu != "")
         {
             EnableSubMenu(manager.workType.subMenu);
         }
     }
     if (activeMenu == null)
     {
         CloseMenu();
     }
 }