private void OnHudReady() { category = new HudAPIv2.MenuRootCategory("Instant Projector", HudAPIv2.MenuRootCategory.MenuFlag.AdminMenu, "Instant Projector"); menuBlockBuildTime = new HudAPIv2.MenuTextInput("Block Build Time - " + config.BlockBuildTime, category, "Enter build time per block in seconds.", OnBlockTimeSubmit); config.OnBlockBuildTimeChanged += Config_OnBlockBuildTimeChanged; menuComponentCostModifier = new HudAPIv2.MenuTextInput("Component Cost Modifier - " + config.ComponentCostModifier, category, "Enter the component cost modifier.", OnCompCostSubmit); config.OnComponentCostModifierChanged += Config_OnComponentCostModifierChanged; menuMinBlocks = new HudAPIv2.MenuTextInput("Min Blocks - " + config.MinBlocks, category, "Enter the minimum number of blocks allowed to build.", OnMinBlocksSubmit); config.OnMinBlocksChanged += Config_OnMinBlocksChanged; menuMaxBlocks = new HudAPIv2.MenuTextInput("Max Blocks - " + config.MaxBlocks, category, "Enter the maximum number of blocks allowed to build.", OnMaxBlocksSubmit); config.OnMaxBlocksChanged += Config_OnMaxBlocksChanged; menuPowerModifier = new HudAPIv2.MenuTextInput("Power Modifier - " + config.PowerModifier, category, "Enter the power modifier.", OnPowerSubmit); config.OnPowerModifierChanged += Config_OnPowerModifierChanged; menuSubgrids = new HudAPIv2.MenuItem("Subgrids - " + config.Subgrids, category, OnSubgridsClick); config.OnSubgridsChanged += Config_OnSubgridsChanged; menuExtraComp = new HudAPIv2.MenuTextInput("Extra Component - " + config.GetExtraCompName(), category, "Enter the extra component with format <typeid>/<subtypeid>", OnExtraCompSubmit); config.OnExtraComponentChanged += Config_OnExtraComponentChanged; menuExtraCompCost = new HudAPIv2.MenuTextInput("Extra Component Cost - " + config.ExtraCompCost, category, "Enter the extra component cost.", OnExtraCompCostSubmit); config.OnExtraCompCostChanged += Config_OnExtraCompCostChanged; }
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); }
/// <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; }