1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Remove requirement of specifying animateOnnter in BackgroundScreen ctor

This commit is contained in:
Dean Herbert 2024-08-05 18:07:46 +09:00
parent b081b47714
commit 6870311c1e
No known key found for this signature in database
7 changed files with 11 additions and 21 deletions

View File

@ -304,11 +304,6 @@ namespace osu.Game.Tests.Visual.Background
{
private bool? lastLoadTriggerCausedChange;
public TestBackgroundScreenDefault()
: base(false)
{
}
public override bool Next()
{
bool didChange = base.Next();

View File

@ -17,13 +17,12 @@ namespace osu.Game.Screens
private const float x_movement_amount = 50;
private readonly bool animateOnEnter;
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
protected BackgroundScreen(bool animateOnEnter = true)
public bool AnimateEntry { get; set; } = true;
protected BackgroundScreen()
{
this.animateOnEnter = animateOnEnter;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
@ -53,12 +52,11 @@ namespace osu.Game.Screens
public override void OnEntering(ScreenTransitionEvent e)
{
if (animateOnEnter)
if (AnimateEntry)
{
this.FadeOut();
this.MoveToX(x_movement_amount);
this.FadeIn(TRANSITION_LENGTH, Easing.InOutQuart);
this.MoveToX(x_movement_amount);
this.MoveToX(0, TRANSITION_LENGTH, Easing.InOutQuart);
}

View File

@ -27,10 +27,14 @@ namespace osu.Game.Screens
if (screen == null)
return false;
if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen)CurrentScreen, screen))
bool isFirstScreen = CurrentScreen == null;
screen.AnimateEntry = !isFirstScreen;
if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen?)CurrentScreen, screen))
return false;
base.Push(screen);
return true;
}
}

View File

@ -42,11 +42,6 @@ namespace osu.Game.Screens.Backgrounds
protected virtual bool AllowStoryboardBackground => true;
public BackgroundScreenDefault(bool animateOnEnter = true)
: base(animateOnEnter)
{
}
[BackgroundDependencyLoader]
private void load(IAPIProvider api, SkinManager skinManager, OsuConfigManager config)
{

View File

@ -90,7 +90,7 @@ namespace osu.Game.Screens.Menu
/// </summary>
protected bool UsingThemedIntro { get; private set; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(false)
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault
{
Colour = Color4.Black
};

View File

@ -21,7 +21,6 @@ namespace osu.Game.Screens.OnlinePlay.Components
private PlaylistItemBackground? background;
protected OnlinePlayBackgroundScreen()
: base(false)
{
AddInternal(new Box
{

View File

@ -1,7 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Graphics.Containers;