1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-11 03:37:20 +08:00

Merge pull request #32162 from nekodex/kiai-sfx

Add SFX for kiai/star fountain activation
This commit is contained in:
Dean Herbert 2025-03-03 19:05:05 +09:00 committed by GitHub
commit 6aaec144c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 3 deletions

View File

@ -3,6 +3,8 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -14,8 +16,11 @@ namespace osu.Game.Screens.Menu
private StarFountain leftFountain = null!; private StarFountain leftFountain = null!;
private StarFountain rightFountain = null!; private StarFountain rightFountain = null!;
private Sample? sample;
private SampleChannel? sampleChannel;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(AudioManager audio)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -34,6 +39,8 @@ namespace osu.Game.Screens.Menu
X = -250, X = -250,
}, },
}; };
sample = audio.Samples.Get(@"Gameplay/fountain-shoot");
} }
private bool isTriggered; private bool isTriggered;
@ -73,6 +80,11 @@ namespace osu.Game.Screens.Menu
rightFountain.Shoot(1); rightFountain.Shoot(1);
break; break;
} }
// Track sample channel to avoid overlapping playback
sampleChannel?.Stop();
sampleChannel = sample?.GetChannel();
sampleChannel?.Play();
} }
} }
} }

View File

@ -3,6 +3,8 @@
using System; using System;
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.Utils; using osu.Framework.Utils;
@ -19,8 +21,11 @@ namespace osu.Game.Screens.Play
private Bindable<bool> kiaiStarFountains = null!; private Bindable<bool> kiaiStarFountains = null!;
private Sample? sample;
private SampleChannel? sampleChannel;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config, AudioManager audio)
{ {
kiaiStarFountains = config.GetBindable<bool>(OsuSetting.StarFountains); kiaiStarFountains = config.GetBindable<bool>(OsuSetting.StarFountains);
@ -41,6 +46,8 @@ namespace osu.Game.Screens.Play
X = -75, X = -75,
}, },
}; };
sample = audio.Samples.Get(@"Gameplay/fountain-shoot");
} }
private bool isTriggered; private bool isTriggered;
@ -66,6 +73,11 @@ namespace osu.Game.Screens.Play
{ {
leftFountain.Shoot(1); leftFountain.Shoot(1);
rightFountain.Shoot(-1); rightFountain.Shoot(-1);
// Track sample channel to avoid overlapping playback
sampleChannel?.Stop();
sampleChannel = sample?.GetChannel();
sampleChannel?.Play();
} }
public partial class GameplayStarFountain : StarFountain public partial class GameplayStarFountain : StarFountain

View File

@ -36,7 +36,7 @@
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="20.1.0" /> <PackageReference Include="Realm" Version="20.1.0" />
<PackageReference Include="ppy.osu.Framework" Version="2025.225.0" /> <PackageReference Include="ppy.osu.Framework" Version="2025.225.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2025.217.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2025.303.0" />
<PackageReference Include="Sentry" Version="5.1.1" /> <PackageReference Include="Sentry" Version="5.1.1" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. --> <!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.39.0" /> <PackageReference Include="SharpCompress" Version="0.39.0" />