Esempio n. 1
0
        private void OnHudReady()
        {
            hudCategory     = new HudAPIv2.MenuRootCategory("Tool Switcher", HudAPIv2.MenuRootCategory.MenuFlag.PlayerMenu, "Tool Switcher");
            modEnabledInput = new HudAPIv2.MenuItem("Mod Enabled - " + ModEnabled, hudCategory, OnModEnabledSubmit);

            toolsCat = new HudAPIv2.MenuSubCategory("Tools", hudCategory, "Tools");

            if (modTools.Count == 0)
            {
                vanillaToolCat = toolsCat;
            }
            else
            {
                vanillaToolCat = new HudAPIv2.MenuSubCategory("Vanilla", toolsCat, "Vanilla Tools");
            }
            welder.Menu   = new ToolMenu(vanillaToolCat, welder, this);
            grinder.Menu  = new ToolMenu(vanillaToolCat, grinder, this);
            drill.Menu    = new ToolMenu(vanillaToolCat, drill, this);
            rifle.Menu    = new ToolMenu(vanillaToolCat, rifle, this);
            pistol.Menu   = new ToolMenu(vanillaToolCat, pistol, this);
            launcher.Menu = new ToolMenu(vanillaToolCat, launcher, this);

            HudAPIv2.MenuSubCategory unknownCategory = null;
            Dictionary <string, HudAPIv2.MenuSubCategory> modToolCats = new Dictionary <string, HudAPIv2.MenuSubCategory>();

            for (int i = 0; i < modTools.Count; i++)
            {
                ModTool t = modTools[i];
                HudAPIv2.MenuCategoryBase c;
                if (t.ModName == null)
                {
                    if (unknownCategory == null)
                    {
                        unknownCategory = new HudAPIv2.MenuSubCategory("Mod: Unknown", toolsCat, "Unknown");
                    }
                    c = unknownCategory;
                }
                else
                {
                    HudAPIv2.MenuSubCategory subC;
                    if (!modToolCats.TryGetValue(t.ModName, out subC))
                    {
                        subC = new HudAPIv2.MenuSubCategory("Mod: " + t.ModName, toolsCat, t.ModName);
                        modToolCats[t.ModName] = subC;
                    }
                    c = subC;
                }
                t.Menu = new ToolMenu(c, t, this);
            }
            this.modToolCats = modToolCats.Values.ToList();

            equipInput     = new HudAPIv2.MenuKeybindInput("Equip All Key - " + ToolSwitcherSession.GetKeyName(EquipAllKey), hudCategory, "Press any key.", OnEquipAllKeySubmit);
            upgradeInput   = new HudAPIv2.MenuKeybindInput("Upgrade Key - " + ToolSwitcherSession.GetKeyName(UpgradeKey), hudCategory, "Press any key.", OnUpgradeKeySubmit);
            downgradeInput = new HudAPIv2.MenuKeybindInput("Downgrade Key - " + ToolSwitcherSession.GetKeyName(DowngradeKey), hudCategory, "Press any key.", OnDowngradeKeySubmit);
        }
Esempio n. 2
0
 public ToolMenu(HudAPIv2.MenuCategoryBase category, Tool tool, ToolGroups config)
 {
     this.tool    = tool;
     this.config  = config;
     toolCategory = new HudAPIv2.MenuSubCategory("", category, tool.Name);
     SetCategoryText();
     keyInput   = new HudAPIv2.MenuKeybindInput("Key - " + ToolSwitcherSession.GetKeyName(tool.Keybind), toolCategory, "Press any key.", OnKeySubmit);
     slotInput  = new HudAPIv2.MenuTextInput("Slot - " + (tool.Slot + 1), toolCategory, "Enter a slot number 1-9.", OnSlotSubmit);
     pageInput  = new HudAPIv2.MenuTextInput("Page - " + (tool.Page + 1), toolCategory, "Enter a page number 1-9.", OnPageSubmit);
     btnEnabled = new HudAPIv2.MenuItem("Enabled - " + tool.Enabled, toolCategory, OnEnabledSubmit);
 }
Esempio n. 3
0
        /// <summary>
        ///     Initialize menu when hud api is registered.
        /// </summary>
        private void OnHudApiRegistered()
        {
            _menu   = new HudAPIv2.MenuRootCategory(Mod.NAME, HudAPIv2.MenuRootCategory.MenuFlag.PlayerMenu, ModText.MenuRootCategoryHeader_CI.GetString());
            _blocks = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_ReplaceBlocks.GetString(ToEnabledDisabledString(Mod.Static.Settings.Blocks)), _menu, OnReplaceBlocksChanged);

            _componentsCategory = new HudAPIv2.MenuSubCategory(ModText.MenuSubCategory_CI_Component.GetString(), _menu, ModText.MenuSubCategoryHeader_CI_Component.GetString());
            _components         = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_ReplaceComponents.GetString(ToEnabledDisabledString(Mod.Static.Settings.Components)), _componentsCategory, OnReplaceComponentsChanged);
            _oldComponents      = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_ReplaceComponentsOld.GetString(ToEnabledDisabledString(Mod.Static.Settings.OldComponents)), _componentsCategory, OnReplaceOldComponentsChanged)
            {
                Interactable = Mod.Static.Settings.Components
            };

            _ingots = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_ReplaceIngots.GetString(ToEnabledDisabledString(Mod.Static.Settings.Ingots)), _menu, OnReplaceIngotsChanged);
            _ores   = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_ReplaceOres.GetString(ToEnabledDisabledString(Mod.Static.Settings.Ores)), _menu, OnReplaceOresChanged);

            _toolsCategory = new HudAPIv2.MenuSubCategory(ModText.MenuSubCategory_CI_Tools.GetString(), _menu, ModText.MenuSubCategoryHeader_CI_Tools.GetString());
            _tools         = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_ReplaceTools.GetString(ToEnabledDisabledString(Mod.Static.Settings.Tools)), _toolsCategory, OnReplaceToolsChanged);
            _fixToolColors = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_FixToolColors.GetString(ToEnabledDisabledString(Mod.Static.Settings.FixToolColors)), _toolsCategory, OnReplaceFixToolColorsChanged)
            {
                Interactable = Mod.Static.Settings.Tools
            };
            _forceOverride = new HudAPIv2.MenuItem(ModText.MenuItemText_CI_ForceOverride.GetString(ToEnabledDisabledString(Mod.Static.Settings.ForceOverride)), _menu, OnReplaceForceOverrideChanged);
            IsRegistered   = true;
        }