1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Tidy up implementation and show on returning with new song

This commit is contained in:
Dean Herbert 2020-01-24 16:23:41 +09:00
parent 3f6fa93365
commit f9a54dfb1d
2 changed files with 25 additions and 32 deletions

View File

@ -78,27 +78,6 @@ namespace osu.Game.Screens.Menu
holdDelay = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay);
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
AddInternal(songTicker = new SongTicker
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Margin = new MarginPadding { Right = 15, Top = 5 }
});
if (host.CanExit)
{
AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
{
Action = () =>
{
if (holdDelay.Value > 0)
confirmAndExit();
else
this.Exit();
}
});
}
AddRangeInternal(new Drawable[]
{
buttonsContainer = new ParallaxContainer
@ -117,8 +96,28 @@ namespace osu.Game.Screens.Menu
}
},
sideFlashes = new MenuSideFlashes(),
songTicker = new SongTicker
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Margin = new MarginPadding { Right = 15, Top = 5 }
}
});
if (host.CanExit)
{
AddInternal(exitConfirmOverlay = new ExitConfirmOverlay
{
Action = () =>
{
if (holdDelay.Value > 0)
confirmAndExit();
else
this.Exit();
}
});
}
buttons.StateChanged += state =>
{
switch (state)
@ -236,9 +235,6 @@ namespace osu.Game.Screens.Menu
buttons.State = ButtonSystemState.EnteringMode;
songTicker.FadeOut(100, Easing.OutQuint);
songTicker.AllowUpdates = false;
this.FadeOut(FADE_OUT_DURATION, Easing.InSine);
buttonsContainer.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine);
@ -249,8 +245,6 @@ namespace osu.Game.Screens.Menu
{
base.OnResuming(last);
songTicker.AllowUpdates = true;
(Background as BackgroundScreenDefault)?.Next();
//we may have consumed our preloaded instance, so let's make another.
@ -277,8 +271,10 @@ namespace osu.Game.Screens.Menu
}
buttons.State = ButtonSystemState.Exit;
this.FadeOut(3000);
songTicker.Hide();
this.FadeOut(3000);
return base.OnExiting(next);
}

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
@ -17,8 +17,6 @@ namespace osu.Game.Screens.Menu
{
private const int fade_duration = 800;
public bool AllowUpdates { get; set; } = true;
[Resolved]
private Bindable<WorkingBeatmap> beatmap { get; set; }
@ -58,8 +56,7 @@ namespace osu.Game.Screens.Menu
private void onBeatmapChanged(ValueChangedEvent<WorkingBeatmap> working)
{
if (!AllowUpdates)
return;
var metadata = beatmap.Value.Metadata;
var metadata = working.NewValue.Metadata;