mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:53:21 +08:00
Merge branch 'master' into drawable-clear-safety
This commit is contained in:
commit
fa7a0a0742
@ -5,8 +5,10 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Screens;
|
||||||
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
@ -32,7 +34,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private readonly Container sizableContainer;
|
private readonly Container sizableContainer;
|
||||||
|
|
||||||
private Drawable backgroundLayer;
|
private BackgroundScreenStack backgroundStack;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new instance.
|
/// Create a new instance.
|
||||||
@ -112,27 +114,29 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private void updateSize()
|
private void updateSize()
|
||||||
{
|
{
|
||||||
|
const float fade_time = 500;
|
||||||
|
|
||||||
if (targetMode == ScalingMode.Everything)
|
if (targetMode == ScalingMode.Everything)
|
||||||
{
|
{
|
||||||
// the top level scaling container manages the background to be displayed while scaling.
|
// the top level scaling container manages the background to be displayed while scaling.
|
||||||
if (requiresBackgroundVisible)
|
if (requiresBackgroundVisible)
|
||||||
{
|
{
|
||||||
if (backgroundLayer == null)
|
if (backgroundStack == null)
|
||||||
LoadComponentAsync(backgroundLayer = new Background("Menu/menu-background-1")
|
{
|
||||||
|
AddInternal(backgroundStack = new BackgroundScreenStack
|
||||||
{
|
{
|
||||||
Colour = OsuColour.Gray(0.1f),
|
Colour = OsuColour.Gray(0.1f),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Depth = float.MaxValue
|
Depth = float.MaxValue
|
||||||
}, d =>
|
|
||||||
{
|
|
||||||
AddInternal(d);
|
|
||||||
d.FadeTo(requiresBackgroundVisible ? 1 : 0, 4000, Easing.OutQuint);
|
|
||||||
});
|
});
|
||||||
else
|
|
||||||
backgroundLayer.FadeIn(500);
|
backgroundStack.Push(new ScalingBackgroundScreen());
|
||||||
|
}
|
||||||
|
|
||||||
|
backgroundStack.FadeIn(fade_time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
backgroundLayer?.FadeOut(500);
|
backgroundStack?.FadeOut(fade_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool scaling = targetMode == null || scalingMode.Value == targetMode;
|
bool scaling = targetMode == null || scalingMode.Value == targetMode;
|
||||||
@ -148,6 +152,14 @@ namespace osu.Game.Graphics.Containers
|
|||||||
sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; });
|
sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ScalingBackgroundScreen : BackgroundScreenDefault
|
||||||
|
{
|
||||||
|
public override void OnEntering(IScreen last)
|
||||||
|
{
|
||||||
|
this.FadeInFromZero(4000, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class AlwaysInputContainer : Container
|
private class AlwaysInputContainer : Container
|
||||||
{
|
{
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||||
|
Loading…
Reference in New Issue
Block a user