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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user