// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Screens; namespace osu.Game.Screens { public partial class BackgroundScreenStack : ScreenStack { public BackgroundScreenStack() : base(false) { RelativeSizeAxes = Axes.Both; Anchor = Anchor.Centre; Origin = Anchor.Centre; } /// /// Attempt to push a new background screen to this stack. /// /// The screen to attempt to push. /// Whether the push succeeded. For example, if the existing screen was already of the correct type this will return false. public bool Push(BackgroundScreen? screen) { if (screen == null) return false; bool isFirstScreen = CurrentScreen == null; screen.AnimateEntry = !isFirstScreen; if (EqualityComparer.Default.Equals((BackgroundScreen?)CurrentScreen, screen)) return false; base.Push(screen); return true; } } }