-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ModAudioPreview): add enabled option
- Loading branch information
1 parent
44f5303
commit be314c4
Showing
5 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
Osu.Patcher.Hook/Patches/Mods/AudioPreview/AudioPreviewOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using JetBrains.Annotations; | ||
using Osu.Stubs.GameModes.Options; | ||
using Osu.Stubs.Wrappers; | ||
|
||
namespace Osu.Patcher.Hook.Patches.Mods.AudioPreview; | ||
|
||
[UsedImplicitly] | ||
internal class AudioPreviewOptions : PatchOptions | ||
{ | ||
/// <summary> | ||
/// Global toggle for disabling and enabling the patch. | ||
/// </summary> | ||
public static readonly BindableWrapper<bool> Enabled = | ||
new(BindableType.Bool, false, Settings.Default.EnableModAudioPreview); | ||
|
||
public override IEnumerable<object> CreateOptions() => | ||
[ | ||
OptionCheckbox.Constructor.Invoke([ | ||
/* title: */ "Apply DT/NC/HT audio effects live", | ||
/* tooltip: */ "Applies the speed & pitch modifiers during song selection, like osu!lazer.", | ||
/* binding: */ Enabled.Bindable, | ||
/* onChange: */ new EventHandler((_, _) => ModAudioEffects.ApplyModEffects(!Enabled.Value)), | ||
]), | ||
]; | ||
|
||
public override void Load(Settings config) => Enabled.Value = config.EnableModAudioPreview; | ||
public override void Save(Settings config) => config.EnableModAudioPreview = Enabled.Value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters