1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-25 18:57:18 +08:00

Fix multiple issues and standardise transforms

This commit is contained in:
Dean Herbert 2020-07-17 19:08:50 +09:00
parent aa992f2e34
commit a39c4236c7
3 changed files with 18 additions and 10 deletions

View File

@ -24,7 +24,8 @@ namespace osu.Game.Screens.Play
{
public abstract class GameplayMenuOverlay : OverlayContainer, IKeyBindingHandler<GlobalAction>
{
private const int transition_duration = 200;
protected const int TRANSITION_DURATION = 200;
private const int button_height = 70;
private const float background_alpha = 0.75f;
@ -156,8 +157,8 @@ namespace osu.Game.Screens.Play
}
}
protected override void PopIn() => this.FadeIn(transition_duration, Easing.In);
protected override void PopOut() => this.FadeOut(transition_duration, Easing.In);
protected override void PopIn() => this.FadeIn(TRANSITION_DURATION, Easing.In);
protected override void PopOut() => this.FadeOut(TRANSITION_DURATION, Easing.In);
// Don't let mouse down events through the overlay or people can click circles while paused.
protected override bool OnMouseDown(MouseDownEvent e) => true;

View File

@ -16,6 +16,8 @@ namespace osu.Game.Screens.Play
{
public Action OnResume;
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
public override string Header => "paused";
public override string Description => "you're not going to do what i think you're going to do, are ya?";
@ -23,6 +25,8 @@ namespace osu.Game.Screens.Play
protected override Action BackAction => () => InternalButtons.Children.First().Click();
private const float minimum_volume = 0.0001f;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@ -34,18 +38,20 @@ namespace osu.Game.Screens.Play
{
Looping = true,
});
// PopIn is called before updating the skin, and when a sample is updated, its "playing" value is reset
// the sample must be played again
pauseLoop.OnSkinChanged += () => pauseLoop.Play();
// SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
pauseLoop.VolumeTo(minimum_volume);
}
protected override void PopIn()
{
base.PopIn();
//SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
pauseLoop.VolumeTo(0.00001f);
pauseLoop.VolumeTo(1.0f, 400, Easing.InQuint);
pauseLoop.VolumeTo(1.0f, TRANSITION_DURATION, Easing.InQuint);
pauseLoop.Play();
}
@ -53,8 +59,7 @@ namespace osu.Game.Screens.Play
{
base.PopOut();
var transformSeq = pauseLoop.VolumeTo(0.0f, 190, Easing.OutQuad);
transformSeq.Finally(_ => pauseLoop.Stop());
pauseLoop.VolumeTo(minimum_volume, TRANSITION_DURATION, Easing.OutQuad).Finally(_ => pauseLoop.Stop());
}
}
}

View File

@ -45,6 +45,10 @@ namespace osu.Game.Skinning
public BindableNumber<double> Tempo => samplesContainer.Tempo;
public override bool IsPresent => Scheduler.HasPendingTasks || IsPlaying;
public bool IsPlaying => samplesContainer.Any(s => s.Playing);
/// <summary>
/// Smoothly adjusts <see cref="Volume"/> over time.
/// </summary>
@ -94,8 +98,6 @@ namespace osu.Game.Skinning
public void Stop() => samplesContainer.ForEach(c => c.Stop());
public override bool IsPresent => Scheduler.HasPendingTasks;
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{
var channels = hitSamples.Select(s =>