Пример #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);
        }
Пример #2
0
        private void OnDowngradeKeySubmit(MyKeys key, bool shift, bool ctrl, bool alt)
        {
            if (!menuEnabled)
            {
                return;
            }

            DowngradeKey        = key;
            downgradeInput.Text = "Downgrade Key - " + ToolSwitcherSession.GetKeyName(key);
            Save();
        }
Пример #3
0
        private void OnEquipAllKeySubmit(MyKeys key, bool shift, bool ctrl, bool alt)
        {
            if (!menuEnabled)
            {
                return;
            }

            EquipAllKey     = key;
            equipInput.Text = "Equip All Key - " + ToolSwitcherSession.GetKeyName(key);
            Save();
        }