private void EnsureSelectedSettingVisible() { if (Utils.GetMenuMovementVertical(InterfaceManager.m_Panel_OptionsMenu, true, false) == 0f) { return; } if (selectedIndex == 0) { scrollBarSlider.value = 0; return; } GameObject setting = currentTab.menuItems[selectedIndex]; float settingY = -setting.transform.localPosition.y; float scrollPanelTop = scrollPanelOffset.localPosition.y + GUIBuilder.gridCellHeight; float scrollPanelBottom = scrollPanelOffset.localPosition.y + scrollPanel.height - GUIBuilder.gridCellHeight; if (settingY < scrollPanelTop) { scrollBarSlider.value += (settingY - scrollPanelTop) / currentTab.scrollBarHeight; GameAudioManager.PlayGUIScroll(); } else if (settingY > scrollPanelBottom) { scrollBarSlider.value += (settingY - scrollPanelBottom) / currentTab.scrollBarHeight; GameAudioManager.PlayGUIScroll(); } }
private void OnScroll(UISlider slider, bool playSound) { scrollPanelOffset.localPosition = new Vector2(0, slider.value * (currentTab?.scrollBarHeight ?? 0)); if (playSound) { GameAudioManager.PlayGUIScroll(); } }
internal static bool Prefix(Panel_Inventory_Examine __instance) { float hoursResearchRemaining = GetHoursResearchRemaining(__instance); int maximumIntervals = Mathf.CeilToInt(hoursResearchRemaining / Settings.GetReadingIntervalHours()); int intervalsToRead = __instance.m_HoursToRead; if (intervalsToRead >= maximumIntervals) { GameAudioManager.PlayGUIError(); } else { ++__instance.m_HoursToRead; GameAudioManager.PlayGUIScroll(); __instance.RefreshHoursToRead(); } return(false); // Never run the original }