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

Add SFX for kiai/star fountain activation #32162

Merged
merged 2 commits into from
Mar 3, 2025
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
14 changes: 13 additions & 1 deletion osu.Game/Screens/Menu/KiaiMenuFountains.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Graphics.Containers;
Expand All @@ -14,8 +16,11 @@ public partial class KiaiMenuFountains : BeatSyncedContainer
private StarFountain leftFountain = null!;
private StarFountain rightFountain = null!;

private Sample? sample;
private SampleChannel? sampleChannel;

[BackgroundDependencyLoader]
private void load()
private void load(AudioManager audio)
{
RelativeSizeAxes = Axes.Both;

Expand All @@ -34,6 +39,8 @@ private void load()
X = -250,
},
};

sample = audio.Samples.Get(@"Gameplay/fountain-shoot");
}

private bool isTriggered;
Expand Down Expand Up @@ -73,6 +80,11 @@ public void Shoot()
rightFountain.Shoot(1);
break;
}

// Track sample channel to avoid overlapping playback
sampleChannel?.Stop();
sampleChannel = sample?.GetChannel();
sampleChannel?.Play();
}
}
}
14 changes: 13 additions & 1 deletion osu.Game/Screens/Play/KiaiGameplayFountains.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Utils;
Expand All @@ -19,8 +21,11 @@ public partial class KiaiGameplayFountains : BeatSyncedContainer

private Bindable<bool> kiaiStarFountains = null!;

private Sample? sample;
private SampleChannel? sampleChannel;

[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, AudioManager audio)
{
kiaiStarFountains = config.GetBindable<bool>(OsuSetting.StarFountains);

Expand All @@ -41,6 +46,8 @@ private void load(OsuConfigManager config)
X = -75,
},
};

sample = audio.Samples.Get(@"Gameplay/fountain-shoot");
}

private bool isTriggered;
Expand All @@ -66,6 +73,11 @@ public void Shoot()
{
leftFountain.Shoot(1);
rightFountain.Shoot(-1);

// Track sample channel to avoid overlapping playback
sampleChannel?.Stop();
sampleChannel = sample?.GetChannel();
sampleChannel?.Play();
}

public partial class GameplayStarFountain : StarFountain
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="20.1.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" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.39.0" />
Expand Down
Loading