1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 19:22:56 +08:00

Don't play logo select sample when actions are playing their own

This commit is contained in:
Dean Herbert 2017-11-25 23:29:08 +09:00
parent 07d6a70028
commit ae48b85827
3 changed files with 17 additions and 9 deletions

View File

@ -180,19 +180,21 @@ namespace osu.Game.Screens.Menu
State = MenuState.TopLevel; State = MenuState.TopLevel;
} }
private void onOsuLogo() private bool onOsuLogo()
{ {
switch (state) switch (state)
{ {
default:
return true;
case MenuState.Initial: case MenuState.Initial:
State = MenuState.TopLevel; State = MenuState.TopLevel;
return; return true;
case MenuState.TopLevel: case MenuState.TopLevel:
buttonsTopLevel.First().TriggerOnClick(); buttonsTopLevel.First().TriggerOnClick();
return; return false;
case MenuState.Play: case MenuState.Play:
buttonsPlay.First().TriggerOnClick(); buttonsPlay.First().TriggerOnClick();
return; return false;
} }
} }

View File

@ -48,7 +48,10 @@ namespace osu.Game.Screens.Menu
private readonly Triangles triangles; private readonly Triangles triangles;
public Action Action; /// <summary>
/// Return value decides whether the logo should play its own sample for the click action.
/// </summary>
public Func<bool> Action;
public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X * 0.74f; public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X * 0.74f;
@ -354,13 +357,12 @@ namespace osu.Game.Screens.Menu
{ {
if (!interactive) return false; if (!interactive) return false;
sampleClick.Play(); if (Action?.Invoke() ?? true)
sampleClick.Play();
flashLayer.ClearTransforms(); flashLayer.ClearTransforms();
flashLayer.Alpha = 0.4f; flashLayer.Alpha = 0.4f;
flashLayer.FadeOut(1500, Easing.OutExpo); flashLayer.FadeOut(1500, Easing.OutExpo);
Action?.Invoke();
return true; return true;
} }

View File

@ -332,7 +332,11 @@ namespace osu.Game.Screens.Select
logo.FadeIn(logo_transition, Easing.OutQuint); logo.FadeIn(logo_transition, Easing.OutQuint);
logo.ScaleTo(0.4f, logo_transition, Easing.OutQuint); logo.ScaleTo(0.4f, logo_transition, Easing.OutQuint);
logo.Action = () => carouselRaisedStart(); logo.Action = () =>
{
carouselRaisedStart();
return true;
};
} }
protected override void LogoExiting(OsuLogo logo) protected override void LogoExiting(OsuLogo logo)