From 805ca80231ad8ff771de10ac8279075db1f6dd74 Mon Sep 17 00:00:00 2001 From: Loloppe Date: Mon, 9 Sep 2024 12:14:27 -0400 Subject: [PATCH 1/2] 1.37.5 --- .../Managers/UI/UserGuideFloatingManager.cs | 2 +- Source/8_UI/Components/Signature.cs | 2 +- Source/8_UI/Components/SmoothSlider.cs | 20 +++++++++---------- Source/8_UI/Components/UndoRedoButtons.cs | 4 ++-- Source/8_UI/ModPanelUI/ModPanelUIHelper.cs | 4 ++-- .../ModPanelUI/Panels/PresetsBrowserPanel.cs | 12 +++++------ Source/8_UI/ModPanelUI/Panels/TopPanel.cs | 4 ++-- .../Modals/AdjustmentModeSelectorModal.cs | 2 +- Source/8_UI/ReeUIComponentV2.cs | 2 +- Source/8_UI/SettingsUI/SettingsUIHelper.cs | 4 ++-- Source/8_UI/UIEvents.cs | 13 ++++++------ .../8_UI/UserGuide/VideoPlayer/PlayButton.cs | 2 +- .../UserGuide/VideoPlayer/RewindSlider.cs | 8 ++++---- Source/EasyOffset.csproj | 9 +++++++++ Source/Plugin.cs | 5 +++++ 15 files changed, 54 insertions(+), 39 deletions(-) diff --git a/Source/2_Core/Managers/UI/UserGuideFloatingManager.cs b/Source/2_Core/Managers/UI/UserGuideFloatingManager.cs index e1e84a4..f9af6f9 100644 --- a/Source/2_Core/Managers/UI/UserGuideFloatingManager.cs +++ b/Source/2_Core/Managers/UI/UserGuideFloatingManager.cs @@ -33,7 +33,7 @@ public void Initialize() { _floatingScreen = FloatingScreen.CreateFloatingScreen(new Vector2(120, 90), true, new Vector3(0, 1, 1), Quaternion.identity); _floatingScreen.SetRootViewController(_userGuideViewController, ViewController.AnimationType.None); - InitializeHandle(_floatingScreen.handle); + InitializeHandle(_floatingScreen.Handle); ResetPosition(); _floatingScreen.gameObject.SetActive(false); diff --git a/Source/8_UI/Components/Signature.cs b/Source/8_UI/Components/Signature.cs index 4357ad6..30a45c2 100644 --- a/Source/8_UI/Components/Signature.cs +++ b/Source/8_UI/Components/Signature.cs @@ -41,7 +41,7 @@ private void InitializeText() { var hoverController = _textComponent.gameObject.AddComponent(); hoverController.HoverStateChangedEvent += OnHoverStateChanged; SetColor(0.0f, 0.8f); - _textComponent.OnClickEvent = OnClick; + _textComponent.OnClickEvent += OnClick; } private void SetColor(float brightness, float alpha) { diff --git a/Source/8_UI/Components/SmoothSlider.cs b/Source/8_UI/Components/SmoothSlider.cs index 887e9f7..57d84a8 100644 --- a/Source/8_UI/Components/SmoothSlider.cs +++ b/Source/8_UI/Components/SmoothSlider.cs @@ -30,7 +30,7 @@ protected override void OnDispose() { private Transform _textTransform; private void InitializeSlider() { - var pointerEventsHandler = _sliderComponent.slider.gameObject.AddComponent(); + var pointerEventsHandler = _sliderComponent.Slider.gameObject.AddComponent(); pointerEventsHandler.smoothSlider = this; var textComponent = _sliderComponent.gameObject.GetComponentsInChildren()[1]; @@ -49,8 +49,8 @@ private void InitializeSlider() { private Material _rightArrowMaterial; private void InitializeButtons() { - _incrementButton = _sliderComponent.slider.GetField("_incButton"); - _decrementButton = _sliderComponent.slider.GetField("_decButton"); + _incrementButton = _sliderComponent.Slider.GetField("_incButton"); + _decrementButton = _sliderComponent.Slider.GetField("_decButton"); _rightArrowMaterial = InstantiateButtonMaterial(_incrementButton); _leftArrowMaterial = InstantiateButtonMaterial(_decrementButton); _buttonEventsReady = false; @@ -85,9 +85,9 @@ public void Setup( AppearanceDescriptor appearanceDescriptor, DirectModeVariable value ) { - _sliderComponent.slider.minValue = rangeDescriptor.MinimalValue; - _sliderComponent.slider.maxValue = rangeDescriptor.MaximalValue; - _sliderComponent.slider.numberOfSteps = rangeDescriptor.NumberOfSteps; + _sliderComponent.Slider.minValue = rangeDescriptor.MinimalValue; + _sliderComponent.Slider.maxValue = rangeDescriptor.MaximalValue; + _sliderComponent.Slider.numberOfSteps = rangeDescriptor.NumberOfSteps; _smoothFactor = rangeDescriptor.SmoothFactor; _formatter = appearanceDescriptor.Formatter; ApplyColor(appearanceDescriptor.Color); @@ -95,12 +95,12 @@ DirectModeVariable value } private void ApplyColor(Color color) { - var colors = _sliderComponent.slider.colors; + var colors = _sliderComponent.Slider.colors; colors.highlightedColor = color.ColorWithAlpha(0.3f); colors.pressedColor = color.ColorWithAlpha(0.4f); - _sliderComponent.slider.colors = colors; + _sliderComponent.Slider.colors = colors; - _sliderComponent.slider.handleColor = color; + _sliderComponent.Slider.handleColor = color; _rightArrowMaterial.color = color; _leftArrowMaterial.color = color; } @@ -158,7 +158,7 @@ private void OnButtonClick() { } private void OnPointerDown(PointerEventData eventData) { - var slider = _sliderComponent.slider; + var slider = _sliderComponent.Slider; if (!slider.IsActive() || !slider.IsInteractable() || eventData.button != PointerEventData.InputButton.Left) return; _currentValue = _targetValue = SliderValue; diff --git a/Source/8_UI/Components/UndoRedoButtons.cs b/Source/8_UI/Components/UndoRedoButtons.cs index dfb958a..5ae4ec4 100644 --- a/Source/8_UI/Components/UndoRedoButtons.cs +++ b/Source/8_UI/Components/UndoRedoButtons.cs @@ -127,7 +127,7 @@ private string UndoButtonHoverHint { if (_undoButtonHoverHint.Equals(value)) return; _undoButtonHoverHint = value; NotifyPropertyChanged(); - UIEvents.NotifyHoverHintUpdated(); + UIEvents.NotifyHoverHintUpdated(null); } } @@ -163,7 +163,7 @@ private string RedoButtonHoverHint { if (_redoButtonHoverHint.Equals(value)) return; _redoButtonHoverHint = value; NotifyPropertyChanged(); - UIEvents.NotifyHoverHintUpdated(); + UIEvents.NotifyHoverHintUpdated(null); } } diff --git a/Source/8_UI/ModPanelUI/ModPanelUIHelper.cs b/Source/8_UI/ModPanelUI/ModPanelUIHelper.cs index 05f999d..7f3f025 100644 --- a/Source/8_UI/ModPanelUI/ModPanelUIHelper.cs +++ b/Source/8_UI/ModPanelUI/ModPanelUIHelper.cs @@ -28,7 +28,7 @@ private static void OnEnabledChanged(bool enabled) { private static void AddTab() { if (_tabActive) return; - PersistentSingleton.instance.AddTab( + BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup.Instance.AddTab( TabName, ResourcePath, PepegaSingletonFix.instance @@ -38,7 +38,7 @@ private static void AddTab() { public static void RemoveTab() { if (!_tabActive) return; - PersistentSingleton.instance.RemoveTab(TabName); + BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup.Instance.RemoveTab(TabName); _tabActive = false; } diff --git a/Source/8_UI/ModPanelUI/Panels/PresetsBrowserPanel.cs b/Source/8_UI/ModPanelUI/Panels/PresetsBrowserPanel.cs index 31dc058..aca624a 100644 --- a/Source/8_UI/ModPanelUI/Panels/PresetsBrowserPanel.cs +++ b/Source/8_UI/ModPanelUI/Panels/PresetsBrowserPanel.cs @@ -59,11 +59,11 @@ private string PresetFileName { private void PresetFilenameOnChange(string value) { for (var i = 0; i < _storedConfigPresets.Count; i++) { if (_storedConfigPresets[i].Name != value) continue; - _presetsBrowserList.tableView.SelectCellWithIdx(i); + _presetsBrowserList.TableView.SelectCellWithIdx(i); return; } - _presetsBrowserList.tableView.ClearSelection(); + _presetsBrowserList.TableView.ClearSelection(); } #endregion @@ -88,18 +88,18 @@ private void PresetsBrowserRefreshOnClick() { } private void UpdatePresetsBrowserList() { - _presetsBrowserList.data.Clear(); + _presetsBrowserList.Data.Clear(); _storedConfigPresets = ConfigPresetsStorage.GetAllStoredPresets(); foreach (var storedConfigPreset in _storedConfigPresets) { - _presetsBrowserList.data.Add(new CustomListTableData.CustomCellInfo( + _presetsBrowserList.Data.Add(new CustomListTableData.CustomCellInfo( PresetUtils.GetPresetCellString(storedConfigPreset) ) ); } - _presetsBrowserList.tableView.ReloadData(); - _presetsBrowserList.tableView.ClearSelection(); + _presetsBrowserList.TableView.ReloadData(); + _presetsBrowserList.TableView.ClearSelection(); } #endregion diff --git a/Source/8_UI/ModPanelUI/Panels/TopPanel.cs b/Source/8_UI/ModPanelUI/Panels/TopPanel.cs index 08e0193..35134fb 100644 --- a/Source/8_UI/ModPanelUI/Panels/TopPanel.cs +++ b/Source/8_UI/ModPanelUI/Panels/TopPanel.cs @@ -81,7 +81,7 @@ private string AdjustmentModeButtonText { [UIAction("am-button-on-click"), UsedImplicitly] private void AdjustmentModeOnClick() { - UIEvents.NotifyAdjustmentModeButtonWasPressed(); + UIEvents.NotifyAdjustmentModeButtonWasPressed(null); } #endregion @@ -102,7 +102,7 @@ private void IsPanelVisibleChanged(bool value) { private void OnControllerTypeChanged(ControllerType controllerType) { UpdateButtonOptions(controllerType); - _assignedButtonComponent.values = _assignedButtonChoices; + _assignedButtonComponent.Values = _assignedButtonChoices; _assignedButtonComponent.Value = PluginConfig.AssignedButton; _assignedButtonComponent.UpdateChoices(); } diff --git a/Source/8_UI/Modals/AdjustmentModeSelectorModal.cs b/Source/8_UI/Modals/AdjustmentModeSelectorModal.cs index c244fd3..404b44a 100644 --- a/Source/8_UI/Modals/AdjustmentModeSelectorModal.cs +++ b/Source/8_UI/Modals/AdjustmentModeSelectorModal.cs @@ -61,7 +61,7 @@ private void InitializeModal() { if (touchable != null) touchable.enabled = false; } - private void ShowModal() { + private void ShowModal(HoverHint hoverHint) { if (_modal == null) return; _modal.Show(true, true); } diff --git a/Source/8_UI/ReeUIComponentV2.cs b/Source/8_UI/ReeUIComponentV2.cs index 09409e6..59bd0e0 100644 --- a/Source/8_UI/ReeUIComponentV2.cs +++ b/Source/8_UI/ReeUIComponentV2.cs @@ -126,7 +126,7 @@ private void DisposeIfNeeded() { private void ParseSelfIfNeeded() { if (_state != State.Uninitialized) return; _state = State.Parsing; - PersistentSingleton.instance.Parse(GetBsmlForType(GetType()), gameObject, this); + BSMLParser.Instance.Parse(GetBsmlForType(GetType()), gameObject, this); _state = State.Parsed; } diff --git a/Source/8_UI/SettingsUI/SettingsUIHelper.cs b/Source/8_UI/SettingsUI/SettingsUIHelper.cs index 17abf3c..72f9771 100644 --- a/Source/8_UI/SettingsUI/SettingsUIHelper.cs +++ b/Source/8_UI/SettingsUI/SettingsUIHelper.cs @@ -20,7 +20,7 @@ public static void Initialize() { private static void AddTab() { if (_tabActive) return; - PersistentSingleton.instance.AddSettingsMenu( + BSMLSettings.Instance.AddSettingsMenu( TabName, ResourcePath, PepegaSingletonFix.instance @@ -30,7 +30,7 @@ private static void AddTab() { public static void RemoveTab() { if (!_tabActive) return; - PersistentSingleton.instance.RemoveSettingsMenu(TabName); + BSMLSettings.Instance.RemoveSettingsMenu(TabName); _tabActive = false; } diff --git a/Source/8_UI/UIEvents.cs b/Source/8_UI/UIEvents.cs index d910c05..10954e6 100644 --- a/Source/8_UI/UIEvents.cs +++ b/Source/8_UI/UIEvents.cs @@ -1,3 +1,4 @@ +using HMUI; using System; namespace EasyOffset; @@ -5,20 +6,20 @@ namespace EasyOffset; internal static class UIEvents { #region AdjustmentModeButtonWasPressed - public static event Action HoverHintUpdatedEvent; + public static event Action HoverHintUpdatedEvent; - public static void NotifyHoverHintUpdated() { - HoverHintUpdatedEvent?.Invoke(); + public static void NotifyHoverHintUpdated(HoverHint hoverHint) { + HoverHintUpdatedEvent?.Invoke(hoverHint); } #endregion #region AdjustmentModeButtonWasPressed - public static event Action AdjustmentModeButtonWasPressedEvent; + public static event Action AdjustmentModeButtonWasPressedEvent; - public static void NotifyAdjustmentModeButtonWasPressed() { - AdjustmentModeButtonWasPressedEvent?.Invoke(); + public static void NotifyAdjustmentModeButtonWasPressed(HoverHint hoverHint) { + AdjustmentModeButtonWasPressedEvent?.Invoke(hoverHint); } #endregion diff --git a/Source/8_UI/UserGuide/VideoPlayer/PlayButton.cs b/Source/8_UI/UserGuide/VideoPlayer/PlayButton.cs index 8ab2a06..8443bcf 100644 --- a/Source/8_UI/UserGuide/VideoPlayer/PlayButton.cs +++ b/Source/8_UI/UserGuide/VideoPlayer/PlayButton.cs @@ -79,7 +79,7 @@ private void UpdateVisuals() { private void InitializeButton() { _hoverController = _button.gameObject.AddComponent(); _hoverController.HoverStateChangedEvent += OnHover; - _button.OnClickEvent = NotifyWasClicked; + _button.OnClickEvent += NotifyWasClicked; } private void OnHover(bool isHovered, float progress) { diff --git a/Source/8_UI/UserGuide/VideoPlayer/RewindSlider.cs b/Source/8_UI/UserGuide/VideoPlayer/RewindSlider.cs index c0244aa..1acac58 100644 --- a/Source/8_UI/UserGuide/VideoPlayer/RewindSlider.cs +++ b/Source/8_UI/UserGuide/VideoPlayer/RewindSlider.cs @@ -26,7 +26,7 @@ protected override void OnInitialize() { private float _currentSeconds; public void SetTime(float currentSeconds, float totalSeconds) { - _sliderComponent.slider.maxValue = totalSeconds; + _sliderComponent.Slider.maxValue = totalSeconds; _sliderComponent.Value = currentSeconds; _currentSeconds = currentSeconds; @@ -88,14 +88,14 @@ private string SliderText { private static Color BarNormalColor => new Color(0.6f, 0.6f, 0.6f, 0.5f); private void InitializeSlider() { - _sliderComponent.slider.valueDidChangeEvent += OnSliderValueDidChange; + _sliderComponent.Slider.valueDidChangeEvent += OnSliderValueDidChange; TryModifySlider(); - var colors = _sliderComponent.slider.colors; + var colors = _sliderComponent.Slider.colors; colors.normalColor = BarNormalColor; colors.pressedColor = BarPressedColor; colors.highlightedColor = BarHighlightColor; - _sliderComponent.slider.colors = colors; + _sliderComponent.Slider.colors = colors; } private void TryModifySlider() { diff --git a/Source/EasyOffset.csproj b/Source/EasyOffset.csproj index 5588110..de8f50b 100644 --- a/Source/EasyOffset.csproj +++ b/Source/EasyOffset.csproj @@ -99,6 +99,9 @@ $(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.Init.dll + + $(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll + $(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.Settings.dll @@ -108,6 +111,9 @@ $(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.UnityExtension.dll + + $(BeatSaberDir)\Beat Saber_Data\Managed\GameInit.dll + $(BeatSaberDir)\Beat Saber_Data\Managed\HMUI.dll @@ -130,6 +136,9 @@ $(BeatSaberDir)\Libs\0Harmony.dll + + $(BeatSaberDir)\Plugins\BS_Utils.dll + $(BeatSaberDir)\Plugins\SiraUtil.dll diff --git a/Source/Plugin.cs b/Source/Plugin.cs index 0c476ff..f9c2912 100644 --- a/Source/Plugin.cs +++ b/Source/Plugin.cs @@ -40,6 +40,11 @@ private static void InitializeAssets() { public static void InitializeUI() { if (_uiInitialized) return; + BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += LateMenuSceneLoadedFresh; + } + + private static void LateMenuSceneLoadedFresh(ScenesTransitionSetupDataSO scene) + { ModPanelUIHelper.Initialize(); SettingsUIHelper.Initialize(); _uiInitialized = true; From a96fb9f6d051f286e17741b1844a82694acd9080 Mon Sep 17 00:00:00 2001 From: Loloppe Date: Mon, 9 Sep 2024 19:36:25 -0400 Subject: [PATCH 2/2] Use new BSML event instead of BS_Utils. --- Source/EasyOffset.csproj | 3 --- Source/Plugin.cs | 4 ++-- Source/manifest.json | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/EasyOffset.csproj b/Source/EasyOffset.csproj index de8f50b..7f94d99 100644 --- a/Source/EasyOffset.csproj +++ b/Source/EasyOffset.csproj @@ -136,9 +136,6 @@ $(BeatSaberDir)\Libs\0Harmony.dll - - $(BeatSaberDir)\Plugins\BS_Utils.dll - $(BeatSaberDir)\Plugins\SiraUtil.dll diff --git a/Source/Plugin.cs b/Source/Plugin.cs index f9c2912..f7f8cc7 100644 --- a/Source/Plugin.cs +++ b/Source/Plugin.cs @@ -40,10 +40,10 @@ private static void InitializeAssets() { public static void InitializeUI() { if (_uiInitialized) return; - BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += LateMenuSceneLoadedFresh; + BeatSaberMarkupLanguage.Util.MainMenuAwaiter.MainMenuInitializing += MainMenuInit; } - private static void LateMenuSceneLoadedFresh(ScenesTransitionSetupDataSO scene) + private static void MainMenuInit() { ModPanelUIHelper.Initialize(); SettingsUIHelper.Initialize(); diff --git a/Source/manifest.json b/Source/manifest.json index 45450d1..d71e2f9 100644 --- a/Source/manifest.json +++ b/Source/manifest.json @@ -5,10 +5,10 @@ "author": "Reezonate", "version": "2.1.11", "description": "Easy controller offset adjustment tool", - "gameVersion": "1.37.3", + "gameVersion": "1.37.5", "dependsOn": { "BSIPA": "^4.3.3", - "BeatSaberMarkupLanguage": "^1.11.0", + "BeatSaberMarkupLanguage": "^1.12.0", "SiraUtil": "^3.1.8" }, "links": {