From d84ffbe11c0b0fbb046d64cbc6227a86c86a598b Mon Sep 17 00:00:00 2001 From: Sirspam <71392316+Sirspam@users.noreply.github.com> Date: Thu, 11 May 2023 15:12:57 +0100 Subject: [PATCH 1/5] Updated to 1.29.4 --- Nya/Nya.csproj | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Nya/Nya.csproj b/Nya/Nya.csproj index 999b630..9aa5184 100644 --- a/Nya/Nya.csproj +++ b/Nya/Nya.csproj @@ -3,7 +3,7 @@ net48 Library - 8 + 9 enable false ..\Refs @@ -12,11 +12,6 @@ portable - - enable - 8.0 - - True @@ -104,6 +99,10 @@ $(BeatSaberDir)\Plugins\SiraUtil.dll false + + $(BeatSaberDir)\Beat Saber_Data\Managed\Tweening.dll + False + From f13328bc80e25cb123c9f07263c5e64525961e2b Mon Sep 17 00:00:00 2001 From: Sirspam <71392316+Sirspam@users.noreply.github.com> Date: Fri, 19 May 2023 19:19:11 +0100 Subject: [PATCH 2/5] Added saved positions --- Nya/Components/NyaSettingsClickableImage.cs | 6 +- Nya/Configuration/PluginConfig.cs | 4 + .../SettingsModalController.cs | 32 +++- .../SettingsModalGameController.cs | 6 +- .../SettingsModalMenuController.cs | 3 + .../NyaSettingsMainViewController.cs | 3 +- Nya/UI/Views/SettingsModalView.bsml | 9 +- Nya/Utils/FloatingScreenUtils.cs | 149 ++++++++++++++---- Nya/Utils/ImageUtils.cs | 4 +- 9 files changed, 170 insertions(+), 46 deletions(-) diff --git a/Nya/Components/NyaSettingsClickableImage.cs b/Nya/Components/NyaSettingsClickableImage.cs index ae89317..b9d70fb 100644 --- a/Nya/Components/NyaSettingsClickableImage.cs +++ b/Nya/Components/NyaSettingsClickableImage.cs @@ -11,7 +11,7 @@ internal sealed class NyaSettingsClickableImage : MonoBehaviour, IPointerClickHa { private AudioClip[] _audioClips = new AudioClip[3]; private AudioSource _basicUIAudioManagerAudioSource = null!; - + private bool _isBogShamb; private PluginConfig _pluginConfig = null!; private IPlatformUserModel _platformUserModel = null!; @@ -21,7 +21,7 @@ public async void Construct(PluginConfig pluginConfig, IPlatformUserModel platfo { _pluginConfig = pluginConfig; _platformUserModel = platformUserModel; - + _isBogShamb = (await _platformUserModel.GetUserInfo()).platformUserId == "76561198087340992"; } @@ -37,7 +37,7 @@ private void Awake() _basicUIAudioManagerAudioSource = BeatSaberUI.BasicUIAudioManager.GetComponent(); } } - + public void OnPointerClick(PointerEventData eventData) { if (_pluginConfig.IsAprilFirst || (_isBogShamb && _pluginConfig.EasterEggs)) diff --git a/Nya/Configuration/PluginConfig.cs b/Nya/Configuration/PluginConfig.cs index 0eb3880..768f910 100644 --- a/Nya/Configuration/PluginConfig.cs +++ b/Nya/Configuration/PluginConfig.cs @@ -27,6 +27,10 @@ internal class PluginConfig public virtual Vector3 MenuRotation { get; set; } = FloatingScreenUtils.DefaultRotation.eulerAngles; public virtual Vector3 PausePosition { get; set; } = FloatingScreenUtils.DefaultPosition; public virtual Vector3 PauseRotation { get; set; } = FloatingScreenUtils.DefaultRotation.eulerAngles; + public virtual Vector3 SavedMenuPosition { get; set; } = FloatingScreenUtils.DefaultPosition; + public virtual Vector3 SavedMenuRotation { get; set; } = FloatingScreenUtils.DefaultRotation.eulerAngles; + public virtual Vector3 SavedPausePosition { get; set; } = FloatingScreenUtils.DefaultPosition; + public virtual Vector3 SavedPauseRotation { get; set; } = FloatingScreenUtils.DefaultRotation.eulerAngles; public virtual bool UseBackgroundColor { get; set; } = false; public virtual Color BackgroundColor { get; set; } = new Color(0.745f, 0.745f, 0.745f); public virtual bool RainbowBackgroundColor { get; set; } = false; diff --git a/Nya/UI/ViewControllers/ModalControllers/SettingsModalController.cs b/Nya/UI/ViewControllers/ModalControllers/SettingsModalController.cs index 614a0d3..3009d9f 100644 --- a/Nya/UI/ViewControllers/ModalControllers/SettingsModalController.cs +++ b/Nya/UI/ViewControllers/ModalControllers/SettingsModalController.cs @@ -104,9 +104,12 @@ protected SettingsModalController(UIUtils uiUtils, ImageUtils imageUtils, MainCa [UIComponent("set-upright-button")] protected readonly Button SetUprightButton = null!; - [UIComponent("default-position-button")] - protected readonly Button DefaultPositionButton = null!; - + [UIComponent("saved-position-button")] + protected readonly Button SavedPositionButton = null!; + + [UIComponent("save-position-button")] + protected readonly Button SavePositionButton = null!; + [UIComponent("show-handle-checkbox")] protected readonly GenericInteractableSetting ShowHandleCheckbox = null!; @@ -267,6 +270,12 @@ protected string NsfwValue set => PluginConfig.SelectedEndpoints[APIValue].SelectedNsfwEndpoint = value; } + [UIValue("saved-position-button-text")] + protected abstract string SavedPositionButtonText + { + get; + } + #endregion #region Actions @@ -329,13 +338,20 @@ protected void SetUprightClicked() _floatingScreenUtils.TweenUpright(); } - [UIAction("default-position-clicked")] - protected void DefaultPositionClicked() + [UIAction("saved-position-clicked")] + protected void SavedPositionClicked() { - _uiUtils.ButtonUnderlineClick(DefaultPositionButton.gameObject); - _floatingScreenUtils.TweenToDefaultPosition(); + _uiUtils.ButtonUnderlineClick(SavedPositionButton.gameObject); + _floatingScreenUtils.TweenToSavedPosition(); } - + + [UIAction("save-position-clicked")] + protected void SavePositionClicked() + { + _uiUtils.ButtonUnderlineClick(SavePositionButton.gameObject); + _floatingScreenUtils.SaveCurrentPosition(); + } + [UIAction("show-handle-changed")] protected void ShowHandleChanged(bool value) { diff --git a/Nya/UI/ViewControllers/ModalControllers/SettingsModalGameController.cs b/Nya/UI/ViewControllers/ModalControllers/SettingsModalGameController.cs index 697eee7..c03f8ad 100644 --- a/Nya/UI/ViewControllers/ModalControllers/SettingsModalGameController.cs +++ b/Nya/UI/ViewControllers/ModalControllers/SettingsModalGameController.cs @@ -1,4 +1,5 @@ -using Nya.Configuration; +using BeatSaberMarkupLanguage.Attributes; +using Nya.Configuration; using Nya.Utils; using Tweening; using UnityEngine; @@ -17,5 +18,8 @@ public void ShowModal(Transform parentTransform) ShowModal(parentTransform, this); MoreSettingsTab.IsVisible = false; } + + [UIValue("saved-position-button-text")] + protected override string SavedPositionButtonText => PluginConfig.SeparatePositions ? "Saved Game Position" : "Saved Position"; } } \ No newline at end of file diff --git a/Nya/UI/ViewControllers/ModalControllers/SettingsModalMenuController.cs b/Nya/UI/ViewControllers/ModalControllers/SettingsModalMenuController.cs index ab5a19d..63690d1 100644 --- a/Nya/UI/ViewControllers/ModalControllers/SettingsModalMenuController.cs +++ b/Nya/UI/ViewControllers/ModalControllers/SettingsModalMenuController.cs @@ -32,6 +32,9 @@ public void ShowModal(Transform parentTransform) ScreenTab.IsVisible = false; } } + + [UIValue("saved-position-button-text")] + protected override string SavedPositionButtonText => PluginConfig.SeparatePositions ? "Saved Menu Position" : "Saved Position"; [UIAction("show-nya-settings")] private void ShowNyaSettings() diff --git a/Nya/UI/ViewControllers/SettingsControllers/NyaSettingsMainViewController.cs b/Nya/UI/ViewControllers/SettingsControllers/NyaSettingsMainViewController.cs index da426d5..1f55b86 100644 --- a/Nya/UI/ViewControllers/SettingsControllers/NyaSettingsMainViewController.cs +++ b/Nya/UI/ViewControllers/SettingsControllers/NyaSettingsMainViewController.cs @@ -126,7 +126,7 @@ private bool UpdateAvailable } [UIValue("restart-required")] - private bool RestartRequired => (InMenu != _pluginConfig.InMenu || EasterEggs != _pluginConfig.EasterEggs) && isActiveAndEnabled; + private bool RestartRequired => (InMenu != _pluginConfig.InMenu || SeparatePositions != _pluginConfig.SeparatePositions || EasterEggs != _pluginConfig.EasterEggs) && isActiveAndEnabled; [UIValue("in-menu")] private bool InMenu @@ -232,6 +232,7 @@ private bool SeparatePositions _separatePositions = value; SeparatePositionsButOpposite = !value; NotifyPropertyChanged(); + NotifyPropertyChanged(nameof(RestartRequired)); } } diff --git a/Nya/UI/Views/SettingsModalView.bsml b/Nya/UI/Views/SettingsModalView.bsml index 6e17c0c..3b74068 100644 --- a/Nya/UI/Views/SettingsModalView.bsml +++ b/Nya/UI/Views/SettingsModalView.bsml @@ -25,9 +25,12 @@ -