Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.37.5 #28

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/2_Core/Managers/UI/UserGuideFloatingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/8_UI/Components/Signature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private void InitializeText() {
var hoverController = _textComponent.gameObject.AddComponent<SmoothHoverController>();
hoverController.HoverStateChangedEvent += OnHoverStateChanged;
SetColor(0.0f, 0.8f);
_textComponent.OnClickEvent = OnClick;
_textComponent.OnClickEvent += OnClick;
}

private void SetColor(float brightness, float alpha) {
Expand Down
20 changes: 10 additions & 10 deletions Source/8_UI/Components/SmoothSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void OnDispose() {
private Transform _textTransform;

private void InitializeSlider() {
var pointerEventsHandler = _sliderComponent.slider.gameObject.AddComponent<PointerEventsHandler>();
var pointerEventsHandler = _sliderComponent.Slider.gameObject.AddComponent<PointerEventsHandler>();
pointerEventsHandler.smoothSlider = this;

var textComponent = _sliderComponent.gameObject.GetComponentsInChildren<TextMeshProUGUI>()[1];
Expand All @@ -49,8 +49,8 @@ private void InitializeSlider() {
private Material _rightArrowMaterial;

private void InitializeButtons() {
_incrementButton = _sliderComponent.slider.GetField<Button, RangeValuesTextSlider>("_incButton");
_decrementButton = _sliderComponent.slider.GetField<Button, RangeValuesTextSlider>("_decButton");
_incrementButton = _sliderComponent.Slider.GetField<Button, RangeValuesTextSlider>("_incButton");
_decrementButton = _sliderComponent.Slider.GetField<Button, RangeValuesTextSlider>("_decButton");
_rightArrowMaterial = InstantiateButtonMaterial(_incrementButton);
_leftArrowMaterial = InstantiateButtonMaterial(_decrementButton);
_buttonEventsReady = false;
Expand Down Expand Up @@ -85,22 +85,22 @@ 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);
SetValue(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;
}
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Source/8_UI/Components/UndoRedoButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private string UndoButtonHoverHint {
if (_undoButtonHoverHint.Equals(value)) return;
_undoButtonHoverHint = value;
NotifyPropertyChanged();
UIEvents.NotifyHoverHintUpdated();
UIEvents.NotifyHoverHintUpdated(null);
}
}

Expand Down Expand Up @@ -163,7 +163,7 @@ private string RedoButtonHoverHint {
if (_redoButtonHoverHint.Equals(value)) return;
_redoButtonHoverHint = value;
NotifyPropertyChanged();
UIEvents.NotifyHoverHintUpdated();
UIEvents.NotifyHoverHintUpdated(null);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Source/8_UI/ModPanelUI/ModPanelUIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static void OnEnabledChanged(bool enabled) {

private static void AddTab() {
if (_tabActive) return;
PersistentSingleton<BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup>.instance.AddTab(
BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup.Instance.AddTab(
TabName,
ResourcePath,
PepegaSingletonFix<ModPanelUI>.instance
Expand All @@ -38,7 +38,7 @@ private static void AddTab() {

public static void RemoveTab() {
if (!_tabActive) return;
PersistentSingleton<BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup>.instance.RemoveTab(TabName);
BeatSaberMarkupLanguage.GameplaySetup.GameplaySetup.Instance.RemoveTab(TabName);
_tabActive = false;
}

Expand Down
12 changes: 6 additions & 6 deletions Source/8_UI/ModPanelUI/Panels/PresetsBrowserPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Source/8_UI/ModPanelUI/Panels/TopPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private string AdjustmentModeButtonText {

[UIAction("am-button-on-click"), UsedImplicitly]
private void AdjustmentModeOnClick() {
UIEvents.NotifyAdjustmentModeButtonWasPressed();
UIEvents.NotifyAdjustmentModeButtonWasPressed(null);
}

#endregion
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/8_UI/Modals/AdjustmentModeSelectorModal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/8_UI/ReeUIComponentV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void DisposeIfNeeded() {
private void ParseSelfIfNeeded() {
if (_state != State.Uninitialized) return;
_state = State.Parsing;
PersistentSingleton<BSMLParser>.instance.Parse(GetBsmlForType(GetType()), gameObject, this);
BSMLParser.Instance.Parse(GetBsmlForType(GetType()), gameObject, this);
_state = State.Parsed;
}

Expand Down
4 changes: 2 additions & 2 deletions Source/8_UI/SettingsUI/SettingsUIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void Initialize() {

private static void AddTab() {
if (_tabActive) return;
PersistentSingleton<BSMLSettings>.instance.AddSettingsMenu(
BSMLSettings.Instance.AddSettingsMenu(
TabName,
ResourcePath,
PepegaSingletonFix<SettingsUI>.instance
Expand All @@ -30,7 +30,7 @@ private static void AddTab() {

public static void RemoveTab() {
if (!_tabActive) return;
PersistentSingleton<BSMLSettings>.instance.RemoveSettingsMenu(TabName);
BSMLSettings.Instance.RemoveSettingsMenu(TabName);
_tabActive = false;
}

Expand Down
13 changes: 7 additions & 6 deletions Source/8_UI/UIEvents.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
using HMUI;
using System;

namespace EasyOffset;

internal static class UIEvents {
#region AdjustmentModeButtonWasPressed

public static event Action HoverHintUpdatedEvent;
public static event Action<HoverHint> 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<HoverHint> AdjustmentModeButtonWasPressedEvent;

public static void NotifyAdjustmentModeButtonWasPressed() {
AdjustmentModeButtonWasPressedEvent?.Invoke();
public static void NotifyAdjustmentModeButtonWasPressed(HoverHint hoverHint) {
AdjustmentModeButtonWasPressedEvent?.Invoke(hoverHint);
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion Source/8_UI/UserGuide/VideoPlayer/PlayButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void UpdateVisuals() {
private void InitializeButton() {
_hoverController = _button.gameObject.AddComponent<SmoothHoverController>();
_hoverController.HoverStateChangedEvent += OnHover;
_button.OnClickEvent = NotifyWasClicked;
_button.OnClickEvent += NotifyWasClicked;
}

private void OnHover(bool isHovered, float progress) {
Expand Down
8 changes: 4 additions & 4 deletions Source/8_UI/UserGuide/VideoPlayer/RewindSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 6 additions & 0 deletions Source/EasyOffset.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
<Reference Include="BeatSaber.Init">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.Init.dll</HintPath>
</Reference>
<Reference Include="BeatSaber.ViewSystem">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll</HintPath>
</Reference>
<Reference Include="BeatSaber.Settings">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.Settings.dll</HintPath>
</Reference>
Expand All @@ -108,6 +111,9 @@
<Reference Include="BGLib.UnityExtension">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.UnityExtension.dll</HintPath>
</Reference>
<Reference Include="GameInit">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\GameInit.dll</HintPath>
</Reference>
<Reference Include="HMUI">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\HMUI.dll</HintPath>
</Reference>
Expand Down
5 changes: 5 additions & 0 deletions Source/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ private static void InitializeAssets() {

public static void InitializeUI() {
if (_uiInitialized) return;
BeatSaberMarkupLanguage.Util.MainMenuAwaiter.MainMenuInitializing += MainMenuInit;
}

private static void MainMenuInit()
{
ModPanelUIHelper.Initialize();
SettingsUIHelper.Initialize();
_uiInitialized = true;
Expand Down
4 changes: 2 additions & 2 deletions Source/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down