/// <summary> /// Moves the decrement button, value, and increment button of an IncDecSettingsController outside of the "Value" transform. /// This method is here for consistency of UI elements and because the "Value" transform has some forced horizontal layout that messes up child RectTransform positioning. /// </summary> /// <param name="controller">An IncDecSettingsController that represents a filter's control's UI element.</param> public static void MoveIncDecViewControllerElements(IncDecSettingsController controller) { var incButton = controller.transform.Find("Value/IncButton") as RectTransform; incButton.SetParent(controller.transform); incButton.anchorMin = new Vector2(1f, 0.5f); incButton.anchorMax = new Vector2(1f, 0.5f); incButton.pivot = new Vector2(1f, 0.5f); incButton.sizeDelta = new Vector2(8f, 8f); incButton.anchoredPosition = Vector2.zero; var text = controller.transform.Find("Value/ValueText") as RectTransform; text.SetParent(controller.transform); text.anchorMin = new Vector2(1f, 0.5f); text.anchorMax = new Vector2(1f, 0.5f); text.pivot = new Vector2(1f, 0.5f); text.sizeDelta = new Vector2(16f, 8f); text.anchoredPosition = new Vector2(-8f, 0f); var decButton = controller.transform.Find("Value/DecButton") as RectTransform; decButton.SetParent(controller.transform); decButton.anchorMin = new Vector2(1f, 0.5f); decButton.anchorMax = new Vector2(1f, 0.5f); decButton.pivot = new Vector2(1f, 0.5f); decButton.sizeDelta = new Vector2(8f, 8f); decButton.anchoredPosition = new Vector2(-24f, 0f); }
static bool Prefix(IncDecSettingsController __instance, Button ___incButton, Button ___decButton) { try { ___incButton.onClick.RemoveListener(__instance.IncButtonPressed); ___decButton.onClick.RemoveListener(__instance.DecButtonPressed); } catch { } return(false); }