mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Update SFX for mod overlay show/hide
This commit is contained in:
@ -6,6 +6,8 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -28,6 +30,9 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
public const int BUTTON_WIDTH = 200;
|
public const int BUTTON_WIDTH = 200;
|
||||||
|
|
||||||
|
protected override string PopInSampleName => "";
|
||||||
|
protected override string PopOutSampleName => @"SongSelect/mod-select-overlay-pop-out";
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; private set; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; private set; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
@ -101,17 +106,21 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private ShearedToggleButton? customisationButton;
|
private ShearedToggleButton? customisationButton;
|
||||||
|
|
||||||
|
private Sample? columnAppearSample;
|
||||||
|
|
||||||
protected ModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green)
|
protected ModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green)
|
||||||
: base(colourScheme)
|
: base(colourScheme)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, OsuColour colours)
|
private void load(OsuGameBase game, OsuColour colours, AudioManager audio)
|
||||||
{
|
{
|
||||||
Header.Title = ModSelectOverlayStrings.ModSelectTitle;
|
Header.Title = ModSelectOverlayStrings.ModSelectTitle;
|
||||||
Header.Description = ModSelectOverlayStrings.ModSelectDescription;
|
Header.Description = ModSelectOverlayStrings.ModSelectDescription;
|
||||||
|
|
||||||
|
columnAppearSample = audio.Samples.Get(@"SongSelect/mod-column-pop-in");
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
new ClickToReturnContainer
|
new ClickToReturnContainer
|
||||||
@ -453,8 +462,32 @@ namespace osu.Game.Overlays.Mods
|
|||||||
.MoveToY(0, duration, Easing.OutQuint)
|
.MoveToY(0, duration, Easing.OutQuint)
|
||||||
.FadeIn(duration, Easing.OutQuint);
|
.FadeIn(duration, Easing.OutQuint);
|
||||||
|
|
||||||
if (!allFiltered)
|
if (allFiltered)
|
||||||
nonFilteredColumnCount += 1;
|
continue;
|
||||||
|
|
||||||
|
int columnNumber = nonFilteredColumnCount;
|
||||||
|
Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
var channel = columnAppearSample?.GetChannel();
|
||||||
|
if (channel == null) return;
|
||||||
|
|
||||||
|
// don't play sample if column isn't visible, but try to play it at least 5 times (assuming there's at least 5 visible columns in `columnFlow`)
|
||||||
|
if (columnNumber > 5 && !column.Active.Value) return;
|
||||||
|
|
||||||
|
// use X position of the column on screen as a basis for panning the sample
|
||||||
|
var bounds = column.Parent.BoundingBox;
|
||||||
|
float balance = (bounds.TopLeft.X + bounds.Width / 2) / RelativeToAbsoluteFactor.X;
|
||||||
|
|
||||||
|
// dip frequency and ramp volume of sample over the first 5 displayed columns
|
||||||
|
float progress = Math.Min(1, columnNumber / 5f);
|
||||||
|
|
||||||
|
channel.Frequency.Value = 1.3 - (progress * 0.3) + RNG.NextDouble(0.1);
|
||||||
|
channel.Volume.Value = Math.Max(progress, 0.2);
|
||||||
|
channel.Balance.Value = -1 + balance * 2;
|
||||||
|
channel.Play();
|
||||||
|
}, delay);
|
||||||
|
|
||||||
|
nonFilteredColumnCount += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user