1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-16 23:43:27 +08:00

Implement sample choking/muting for ButtonSystem samples

This commit is contained in:
Jamie Taylor
2023-11-08 22:18:33 +09:00
Unverified
parent f0a1df06ac
commit f69c2ea39b
4 changed files with 26 additions and 2 deletions
+10
View File
@@ -199,6 +199,7 @@ namespace osu.Game.Screens.Menu
{
if (State == ButtonSystemState.Initial)
{
StopSamplePlayback();
logo?.TriggerClick();
return true;
}
@@ -264,12 +265,14 @@ namespace osu.Game.Screens.Menu
State = ButtonSystemState.Initial;
// Samples are explicitly played here in response to user interaction and not when transitioning due to idle.
StopSamplePlayback();
sampleBackToLogo?.Play();
sampleLogoSwoosh?.Play();
return true;
case ButtonSystemState.Play:
StopSamplePlayback();
backButton.TriggerClick();
return true;
@@ -278,6 +281,13 @@ namespace osu.Game.Screens.Menu
}
}
public void StopSamplePlayback()
{
buttonsPlay.ForEach(button => button.StopSamplePlayback());
buttonsTopLevel.ForEach(button => button.StopSamplePlayback());
logo?.StopSamplePlayback();
}
private bool onOsuLogo()
{
switch (state)