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

UI SFX Tweaks/Updates #28832

Merged
merged 3 commits into from
Jul 13, 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
6 changes: 0 additions & 6 deletions osu.Game/Graphics/UserInterface/HoverSampleSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ public enum HoverSampleSet
[Description("button-sidebar")]
ButtonSidebar,

[Description("toolbar")]
Toolbar,

[Description("tabselect")]
TabSelect,

[Description("scrolltotop")]
ScrollToTop,

[Description("dialog-cancel")]
DialogCancel,

Expand Down
8 changes: 4 additions & 4 deletions osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void load(AudioManager audio)
protected override void LoadComplete()
{
base.LoadComplete();
Progress.BindValueChanged(progressChanged, true);
Progress.BindValueChanged(progressChanged);
}

protected override void Confirm()
Expand Down Expand Up @@ -114,13 +114,13 @@ private void progressChanged(ValueChangedEvent<double> progress)
if (progress.NewValue < progress.OldValue)
return;

if (Clock.CurrentTime - lastTickPlaybackTime < 30)
if (Clock.CurrentTime - lastTickPlaybackTime < 40)
return;

var channel = tickSample.GetChannel();

channel.Frequency.Value = 1 + progress.NewValue * 0.5f;
channel.Volume.Value = 0.5f + progress.NewValue / 2f;
channel.Frequency.Value = 1 + progress.NewValue;
channel.Volume.Value = 0.1f + progress.NewValue / 2f;

channel.Play();

Expand Down
19 changes: 17 additions & 2 deletions osu.Game/Overlays/OverlayScrollContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
Expand Down Expand Up @@ -112,8 +114,12 @@ public Visibility State

public Bindable<float?> LastScrollTarget = new Bindable<float?>();

protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();

private Sample scrollToTopSample;
private Sample scrollToPreviousSample;

public ScrollBackButton()
: base(HoverSampleSet.ScrollToTop)
{
Size = new Vector2(50);
Alpha = 0;
Expand Down Expand Up @@ -150,11 +156,14 @@ public ScrollBackButton()
}

[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load(OverlayColourProvider colourProvider, AudioManager audio)
{
IdleColour = colourProvider.Background6;
HoverColour = colourProvider.Background5;
flashColour = colourProvider.Light1;

scrollToTopSample = audio.Samples.Get(@"UI/scroll-to-top");
scrollToPreviousSample = audio.Samples.Get(@"UI/scroll-to-previous");
}

protected override void LoadComplete()
Expand All @@ -171,6 +180,12 @@ protected override void LoadComplete()
protected override bool OnClick(ClickEvent e)
{
background.FlashColour(flashColour, 800, Easing.OutQuint);

if (LastScrollTarget.Value == null)
scrollToTopSample?.Play();
else
scrollToPreviousSample?.Play();

return base.OnClick(e);
}

Expand Down
2 changes: 1 addition & 1 deletion osu.Game/osu.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</PackageReference>
<PackageReference Include="Realm" Version="11.5.0" />
<PackageReference Include="ppy.osu.Framework" Version="2024.702.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.705.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.713.0" />
<PackageReference Include="Sentry" Version="4.3.0" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.36.0" />
Expand Down
Loading