Ejemplo n.º 1
0
            private static void Postfix(Panel_OptionsMenu __instance)
            {
                InterfaceManager.m_Panel_OptionsMenu = __instance;
                ObjectPrefabs.Initialize(__instance);

                DateTime tStart = DateTime.UtcNow;

                try {
                    MelonLogger.Msg("Building Mod Settings GUI");
                    ModSettingsMenu.BuildGUI();
                } catch (Exception e) {
                    MelonLogger.Error("Exception while building Mod Settings GUI\n" + e.ToString());
                    return;
                }
                try {
                    MelonLogger.Msg("Building Custom Mode GUI");
                    CustomModeMenu.BuildGUI();
                } catch (Exception e) {
                    MelonLogger.Error("Exception while building Custom Mode GUI\n" + e.ToString());
                    return;
                }

                long timeMillis = (long)(DateTime.UtcNow - tStart).TotalMilliseconds;

                MelonLogger.Msg("Done! Took " + timeMillis + " ms. Have a nice day!");
            }
        private static float GetRawMenuInputHorizontal()
        {
            Panel_OptionsMenu options      = InterfaceManager.m_Panel_OptionsMenu;
            float             origDeadzone = InputSystemRewired.m_MenuNavigationDeadzone;

            InputSystemRewired.m_MenuNavigationDeadzone = MENU_DEADZONE;
            float result = InputManager.GetMenuNavigationPrimary(options).x + InputManager.GetMenuNavigationSecondary(options).x;

            InputSystemRewired.m_MenuNavigationDeadzone = origDeadzone;
            return(result);
        }
Ejemplo n.º 3
0
            private static bool Prefix(Panel_OptionsMenu __instance)
            {
                ModSettingsGUI gui = GetModSettingsGUI(__instance);

                if (!gui.gameObject.activeInHierarchy)
                {
                    return(true);
                }

                GameAudioManager.PlayGuiConfirm();
                gui.CallOnConfirm();

                return(false);
            }
Ejemplo n.º 4
0
        internal static GameObject CreateModComponentTab()
        {
            Panel_OptionsMenu panel = InterfaceManager.m_Panel_OptionsMenu;
            Transform         pages = panel.transform.Find("Pages");
            GameObject        tab   = Object.Instantiate(panel.m_QualityTab, pages);

            tab.name = "ModComponent";

            Transform titleLabel = tab.transform.Find("TitleDisplay/Label");

            Object.Destroy(titleLabel.GetComponent <UILocalize>());
            titleLabel.GetComponent <UILabel>().text = "ModComponent";

            panel.m_MainMenuItemTabs.Add(tab);
            panel.m_Tabs.Add(tab);

            return(tab);
        }
        internal static void Initialize(Panel_OptionsMenu optionsPanel)
        {
            if (isInitialized)
            {
                return;
            }

            Transform firstSection = InterfaceManager.LoadPanel <Panel_CustomXPSetup>().m_ScrollPanelOffsetTransform.GetChild(0);

            HeaderLabelPrefab = UnityEngine.Object.Instantiate(firstSection.Find("Header").gameObject);
            HeaderLabelPrefab.SetActive(false);

            ComboBoxPrefab = UnityEngine.Object.Instantiate(InterfaceManager.LoadPanel <Panel_CustomXPSetup>().m_AllowInteriorSpawnPopupList.gameObject);
            ComboBoxPrefab.SetActive(false);

            CustomComboBoxPrefab = MakeCustomComboBoxPrefab();
            CustomComboBoxPrefab.SetActive(false);

            DisplayPrefab = MakeDisplayPrefab();
            DisplayPrefab.SetActive(false);

            EmptyPrefab = MakeEmptyPrefab();
            EmptyPrefab.SetActive(false);

            KeyEntryPrefab = MakeKeyEntryPrefab(optionsPanel);
            KeyEntryPrefab.SetActive(false);

            TextEntryPrefab = MakeTextEntryPrefab();
            TextEntryPrefab.SetActive(false);

            UnityEngine.Object.DestroyImmediate(optionsPanel.m_FieldOfViewSlider.m_SliderObject.GetComponent <GenericSliderSpawner>());
            SliderPrefab = UnityEngine.Object.Instantiate(optionsPanel.m_FieldOfViewSlider.gameObject);
            SliderPrefab.SetActive(false);
            SliderPrefab.transform.Find("Label_FOV").localPosition = new Vector3(-10, 0, -1);

            // Fix slider hitbox
            BoxCollider collider = SliderPrefab.GetComponentInChildren <BoxCollider>();

            collider.center = new Vector3(150, 0);
            collider.size   = new Vector3(900, 30);

            isInitialized = true;
        }
Ejemplo n.º 6
0
        static bool PanelOptionsMenu_OnGUI_Prefix(Panel_OptionsMenu __instance)
        {
            if (!bindingNow)
            {
                return(true);
            }

            var key = getPressedKey();

            if (key == KeyCode.None)
            {
                return(false);
            }

            bindingNow.key = key == KeyCode.Escape? KeyCode.None: key;
            __instance.SettingsNeedConfirmation();

            stopBinding();
            return(false);
        }
Ejemplo n.º 7
0
            internal static void Postfix(Panel_OptionsMenu __instance)
            {
                if (!ModComponentMenu.HasVisiblePages())
                {
                    return;
                }

                BasicMenu basicMenu = __instance.m_BasicMenu;

                if (basicMenu is null)
                {
                    return;
                }

                //AddAnotherMenuItem(basicMenu); // We need one more than they have...
                BasicMenu.BasicMenuItemModel firstItem = basicMenu.m_ItemModelList[0];
                int itemIndex = basicMenu.GetItemCount();

                basicMenu.AddItem("ModComponent", MODCOMPONENT_ID, itemIndex, "ModComponent", "View information about ModComponent and your installed item packs.", null,
                                  new Action(() => ShowModComponentMenu(__instance)), firstItem.m_NormalTint, firstItem.m_HighlightTint);
            }
        private static GameObject MakeKeyEntryPrefab(Panel_OptionsMenu optionsPanel)
        {
            GameObject result = GameObject.Instantiate(ComboBoxPrefab);

            Transform  rebindingTab     = optionsPanel.m_RebindingTab.transform;
            GameObject originalButton   = rebindingTab?.FindChild("GameObject")?.FindChild("LeftSide")?.FindChild("Button_Rebinding")?.gameObject;
            GameObject keybindingButton = GameObject.Instantiate(originalButton);

            keybindingButton.transform.position = result.transform.FindChild("Label_Value").position;
            keybindingButton.transform.parent   = result.transform;
            keybindingButton.name = "Keybinding_Button";

            GameObject.DestroyImmediate(result.GetComponent <ConsoleComboBox>());
            result.DestroyChild("Button_Decrease");
            result.DestroyChild("Button_Increase");
            result.DestroyChild("Label_Value");

            keybindingButton.DestroyChild("Label_Name");

            return(result);
        }
Ejemplo n.º 9
0
            private static void Postfix(Panel_OptionsMenu __instance)
            {
                if (!ModSettingsMenu.HasVisibleModSettings(isMainMenu: InterfaceManager.IsMainMenuActive()))
                {
                    return;
                }

                BasicMenu basicMenu = __instance.m_BasicMenu;

                if (basicMenu == null)
                {
                    return;
                }

                AddAnotherMenuItem(basicMenu);                 // We need one more than they have...
                BasicMenu.BasicMenuItemModel firstItem = basicMenu.m_ItemModelList[0];
                int itemIndex = basicMenu.GetItemCount();

                basicMenu.AddItem("ModSettings", MOD_SETTINGS_ID, itemIndex, "Mod Settings", "Change the configuration of your mods", null,
                                  new Action(() => ShowModSettings(__instance)), firstItem.m_NormalTint, firstItem.m_HighlightTint);
            }
Ejemplo n.º 10
0
        internal static GUI GetModComponentMenuGUI(Panel_OptionsMenu panel)
        {
            Transform panelTransform = panel.transform.Find("Pages/ModComponent");

            return(panelTransform.GetComponent <GUI>());
        }
Ejemplo n.º 11
0
            internal static void ShowModComponentMenu(Panel_OptionsMenu __instance)
            {
                GUI settings = GetModComponentMenuGUI(__instance);

                settings.Enable(__instance);
            }
Ejemplo n.º 12
0
            private static void Prefix(Panel_OptionsMenu __instance)
            {
                GameObject settingsTab = GetSettingsTab(__instance);

                settingsTab.SetActive(false);
            }
Ejemplo n.º 13
0
            private static void ShowModSettings(Panel_OptionsMenu __instance)
            {
                ModSettingsGUI settings = GetModSettingsGUI(__instance);

                settings.Enable(__instance);
            }
Ejemplo n.º 14
0
 private static GameObject GetSettingsTab(Panel_OptionsMenu panel)
 {
     return(panel.transform.Find("Pages/ModSettings").gameObject);
 }
Ejemplo n.º 15
0
        private static ModSettingsGUI GetModSettingsGUI(Panel_OptionsMenu panel)
        {
            Transform panelTransform = panel.transform.Find("Pages/ModSettings");

            return(panelTransform.GetComponent <ModSettingsGUI>());
        }
Ejemplo n.º 16
0
            internal static void Prefix(Panel_OptionsMenu __instance)
            {
                GameObject modComponentTab = GetModComponentTab(__instance);

                modComponentTab.SetActive(false);
            }
Ejemplo n.º 17
0
 internal static GameObject GetModComponentTab(Panel_OptionsMenu panel)
 {
     return(panel.transform.Find("Pages/ModComponent").gameObject);
 }
Ejemplo n.º 18
0
 internal void Enable(Panel_OptionsMenu parentMenu)
 {
     GameAudioManager.PlayGUIButtonClick();
     parentMenu.SetTabActive(gameObject);
 }