From 60856fd4e7b12ef3e252fcf59331c22fa2e7a38c Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Tue, 19 Mar 2024 14:34:27 +0000 Subject: [PATCH] let local rotation --- .../NewMenuSystem/OptionsMenuManager.cs | 12 ++++++++++++ .../NewMenuSystem/PauseMenuManager.cs | 2 ++ .../NewMenuSystem/PopupMenuManager.cs | 7 +++++++ .../NewMenuSystem/TitleMenuManager.cs | 1 + 4 files changed, 22 insertions(+) diff --git a/src/OWML.ModHelper.Menus/NewMenuSystem/OptionsMenuManager.cs b/src/OWML.ModHelper.Menus/NewMenuSystem/OptionsMenuManager.cs index 3839cad4..406e0c17 100644 --- a/src/OWML.ModHelper.Menus/NewMenuSystem/OptionsMenuManager.cs +++ b/src/OWML.ModHelper.Menus/NewMenuSystem/OptionsMenuManager.cs @@ -29,6 +29,7 @@ public OptionsMenuManager(IModConsole console, IModUnityEvents unityEvents, IPop var newMenu = Object.Instantiate(existingMenu); newMenu.transform.parent = existingMenu.transform.parent; newMenu.transform.localScale = Vector3.one; + newMenu.transform.localRotation = Quaternion.identity; var rt = newMenu.GetComponent(); var ert = existingMenu.GetComponent(); rt.anchorMin = ert.anchorMin; @@ -80,6 +81,7 @@ public OptionsMenuManager(IModConsole console, IModUnityEvents unityEvents, IPop var newSubMenu = Object.Instantiate(existingTabbedSubMenu); newSubMenu.transform.parent = existingTabbedSubMenu.transform.parent; newSubMenu.transform.localScale = Vector3.one; + newSubMenu.transform.localRotation = Quaternion.identity; var rectTransform = newSubMenu.GetComponent(); rectTransform.anchorMin = existingTabbedSubMenu.GetComponent().anchorMin; rectTransform.anchorMax = existingTabbedSubMenu.GetComponent().anchorMax; @@ -163,6 +165,7 @@ public void RemoveTab(Menu tab) var newSubMenuTabButton = Object.Instantiate(existingSubMenuTabButton); newSubMenuTabButton.transform.parent = menu.transform.Find("SubMenuTabs"); newSubMenuTabButton.transform.localScale = Vector3.one; + newSubMenuTabButton.transform.localRotation = Quaternion.identity; newSubMenuTabButton.transform.SetSiblingIndex(newSubMenuTabButton.transform.parent.childCount - 2); newSubMenuTabButton.name = $"Button-{name}Tab"; Object.Destroy(newSubMenuTabButton.GetComponentInChildren()); @@ -172,6 +175,7 @@ public void RemoveTab(Menu tab) newSubMenu.transform.parent = menu.transform; newSubMenu.transform.localScale = Vector3.one; newSubMenu.name = $"Menu{name}"; + newSubMenu.transform.localRotation = Quaternion.identity; var rt = newSubMenu.GetComponent(); var ert = existingSubMenu.GetComponent(); @@ -230,6 +234,7 @@ public IOWMLToggleElement AddCheckboxInput(Menu menu, string label, string toolt newCheckbox.transform.parent = GetParentForAddedElements(menu); newCheckbox.transform.localScale = Vector3.one; newCheckbox.transform.name = $"UIElement-{label}"; + newCheckbox.transform.localRotation = Quaternion.identity; Object.Destroy(newCheckbox.GetComponentInChildren()); @@ -277,6 +282,7 @@ public IOWMLTwoButtonToggleElement AddToggleInput(Menu menu, string label, strin newToggle.transform.parent = GetParentForAddedElements(menu); newToggle.transform.localScale = Vector3.one; newToggle.transform.name = $"UIElement-{label}"; + newToggle.transform.localRotation = Quaternion.identity; // no idea why, but the prefab doesnt have this newToggle.GetComponent().preferredHeight = 70; @@ -325,6 +331,7 @@ public IOWMLOptionsSelectorElement AddSelectorInput(Menu menu, string label, str newSelector.transform.parent = GetParentForAddedElements(menu); newSelector.transform.localScale = Vector3.one; newSelector.transform.name = $"UIElement-{label}"; + newSelector.transform.localRotation = Quaternion.identity; Object.Destroy(newSelector.GetComponentInChildren()); @@ -372,6 +379,7 @@ public IOWMLSliderElement AddSliderInput(Menu menu, string label, float lower, f newSlider.transform.parent = GetParentForAddedElements(menu); newSlider.transform.localScale = Vector3.one; newSlider.transform.name = $"UIElement-{label}"; + newSlider.transform.localRotation = Quaternion.identity; Object.Destroy(newSlider.GetComponentInChildren()); @@ -461,6 +469,7 @@ public SubmitAction CreateButton(Menu menu, string buttonLabel, string tooltip, newButtonObj.transform.parent = GetParentForAddedElements(menu); newButtonObj.transform.localScale = Vector3.one; newButtonObj.name = $"UIElement-Button-{buttonLabel}"; + newButtonObj.transform.localRotation = Quaternion.identity; // the thing we're copying is already LEFT, so dont need to handle it if (side == MenuSide.CENTER) @@ -517,6 +526,7 @@ public SubmitAction CreateButtonWithLabel(Menu menu, string label, string button var newHorizLayout = Object.Instantiate(existingHorizLayout); newHorizLayout.transform.parent = newButtonObj.transform; newHorizLayout.transform.localScale = Vector3.one; + newHorizLayout.transform.localRotation = Quaternion.identity; var hrt = newHorizLayout.GetComponent(); var ohrt = existingHorizLayout.GetComponent(); @@ -552,6 +562,7 @@ public SubmitAction CreateButtonWithLabel(Menu menu, string label, string button newButton.transform.parent = controlBlock; newButton.transform.localScale = Vector3.one; newButton.name = $"UIElement-{label}"; + newButton.transform.localRotation = Quaternion.identity; var rt = newButton.GetComponent(); var ort = existingHorizLayout.transform.Find("ControlBlock").Find("HorizontalLayoutGroup").GetComponent(); @@ -694,6 +705,7 @@ private TabButton CreateTabButton(string name, Menu menu) newButton.transform.localScale = Vector3.one; newButton.transform.SetSiblingIndex(newButton.transform.parent.childCount - 2); newButton.name = $"Button-{name}"; + newButton.transform.localRotation = Quaternion.identity; RecalculateNavigation(newButton.transform.parent.GetComponentsInChildren