1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 12:02:57 +08:00
osu-lazer/osu.Game/Screens/BackgroundScreenStack.cs

40 lines
1.2 KiB
C#
Raw Normal View History

2019-01-29 20:48:35 +08:00
// 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.
2022-06-17 15:37:17 +08:00
#nullable disable
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Screens;
namespace osu.Game.Screens
{
2022-11-24 13:32:20 +08:00
public partial class BackgroundScreenStack : ScreenStack
{
public BackgroundScreenStack()
: base(false)
{
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
/// <summary>
/// Attempt to push a new background screen to this stack.
/// </summary>
/// <param name="screen">The screen to attempt to push.</param>
/// <returns>Whether the push succeeded. For example, if the existing screen was already of the correct type this will return <c>false</c>.</returns>
public bool Push(BackgroundScreen screen)
{
if (screen == null)
return false;
if (EqualityComparer<BackgroundScreen>.Default.Equals((BackgroundScreen)CurrentScreen, screen))
return false;
base.Push(screen);
return true;
}
}
2019-01-29 20:48:35 +08:00
}