1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 21:32:57 +08:00

Merge branch 'ppy:master' into master

This commit is contained in:
maromalo 2022-04-23 00:17:40 -03:00 committed by GitHub
commit 85c47e1ba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 149 deletions

View File

@ -165,7 +165,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("click outside content", () => AddStep("click outside content", () =>
{ {
InputManager.MoveMouseTo(overlay.ScreenSpaceDrawQuad.TopLeft - new Vector2(1)); InputManager.MoveMouseTo(new Vector2(overlay.ScreenSpaceDrawQuad.TopLeft.X, overlay.ScreenSpaceDrawQuad.Centre.Y));
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });

View File

@ -7,10 +7,8 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
@ -18,25 +16,22 @@ using osu.Framework.Localisation;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Localisation; using osu.Game.Localisation;
using osu.Game.Overlays.FirstRunSetup; using osu.Game.Overlays.FirstRunSetup;
using osu.Game.Overlays.Mods;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using osu.Game.Screens; using osu.Game.Screens;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.OnlinePlay.Match.Components;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
[Cached] [Cached]
public class FirstRunSetupOverlay : OsuFocusedOverlayContainer public class FirstRunSetupOverlay : ShearedOverlayContainer
{ {
protected override bool StartHidden => true; protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Purple;
[Resolved] [Resolved]
private IPerformFromScreenRunner performer { get; set; } = null!; private IPerformFromScreenRunner performer { get; set; } = null!;
@ -52,15 +47,10 @@ namespace osu.Game.Overlays
public PurpleTriangleButton NextButton = null!; public PurpleTriangleButton NextButton = null!;
public DangerousTriangleButton BackButton = null!; public DangerousTriangleButton BackButton = null!;
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
private readonly Bindable<bool> showFirstRunSetup = new Bindable<bool>(); private readonly Bindable<bool> showFirstRunSetup = new Bindable<bool>();
private int? currentStepIndex; private int? currentStepIndex;
private const float scale_when_hidden = 0.9f;
/// <summary> /// <summary>
/// The currently displayed screen, if any. /// The currently displayed screen, if any.
/// </summary> /// </summary>
@ -76,149 +66,89 @@ namespace osu.Game.Overlays
private Bindable<OverlayActivation>? overlayActivationMode; private Bindable<OverlayActivation>? overlayActivationMode;
public FirstRunSetupOverlay() private Container content = null!;
{
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Anchor = Anchor.Centre; Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle;
Origin = Anchor.Centre; Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription;
RelativeSizeAxes = Axes.Both; MainAreaContent.AddRange(new Drawable[]
Size = new Vector2(0.95f);
EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Shadow, content = new Container
Radius = 5,
Colour = Color4.Black.Opacity(0.2f),
};
Masking = true;
CornerRadius = 10;
Children = new Drawable[]
{
new Box
{ {
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background6, Padding = new MarginPadding { Horizontal = 50 },
}, Child = new InputBlockingContainer
new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{ {
new Dimension(GridSizeMode.AutoSize), Masking = true,
new Dimension(), CornerRadius = 14,
new Dimension(GridSizeMode.AutoSize), RelativeSizeAxes = Axes.Both,
}, Children = new Drawable[]
Content = new[]
{
new Drawable[]
{ {
new Container new Box
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new Box
{
Colour = colourProvider.Background5,
RelativeSizeAxes = Axes.Both,
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding(10),
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OsuSpriteText
{
Text = FirstRunSetupOverlayStrings.FirstRunSetupTitle,
Font = OsuFont.Default.With(size: 32),
Colour = colourProvider.Content1,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new OsuTextFlowContainer
{
Text = FirstRunSetupOverlayStrings.FirstRunSetupDescription,
Colour = colourProvider.Content2,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
},
}
},
}
},
},
new Drawable[]
{
stackContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(20), Colour = ColourProvider.Background6,
}, },
}, stackContainer = new Container
new Drawable[]
{
new Container
{ {
RelativeSizeAxes = Axes.X, Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Y, Origin = Anchor.Centre,
Padding = new MarginPadding(20) RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
{ {
Top = 0 // provided by the stack container above. Vertical = 20,
}, Horizontal = 20,
Child = new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new[]
{
BackButton = new DangerousTriangleButton
{
Width = 200,
Text = CommonStrings.Back,
Action = showPreviousStep,
Enabled = { Value = false },
},
Empty(),
NextButton = new PurpleTriangleButton
{
RelativeSizeAxes = Axes.X,
Width = 1,
Text = FirstRunSetupOverlayStrings.GetStarted,
Action = showNextStep
}
},
}
}, },
} }
} },
} },
}, },
}; });
FooterContent.Add(new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Width = 0.98f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(),
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new[]
{
BackButton = new DangerousTriangleButton
{
Width = 200,
Text = CommonStrings.Back,
Action = showPreviousStep,
Enabled = { Value = false },
},
Empty(),
NextButton = new PurpleTriangleButton
{
RelativeSizeAxes = Axes.X,
Width = 1,
Text = FirstRunSetupOverlayStrings.GetStarted,
Action = showNextStep
}
},
}
});
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -280,10 +210,8 @@ namespace osu.Game.Overlays
{ {
base.PopIn(); base.PopIn();
this.ScaleTo(scale_when_hidden) content.ScaleTo(0.99f)
.ScaleTo(1, 400, Easing.OutElasticHalf); .ScaleTo(1, 400, Easing.OutQuint);
this.FadeIn(400, Easing.OutQuint);
if (currentStepIndex == null) if (currentStepIndex == null)
showFirstStep(); showFirstStep();
@ -291,6 +219,10 @@ namespace osu.Game.Overlays
protected override void PopOut() protected override void PopOut()
{ {
base.PopOut();
content.ScaleTo(0.99f, 400, Easing.OutQuint);
if (overlayActivationMode != null) if (overlayActivationMode != null)
{ {
// If this is non-null we are guaranteed to have come from the main menu. // If this is non-null we are guaranteed to have come from the main menu.
@ -316,11 +248,6 @@ namespace osu.Game.Overlays
stack?.FadeOut(100) stack?.FadeOut(100)
.Expire(); .Expire();
} }
base.PopOut();
this.ScaleTo(0.96f, 400, Easing.OutQuint);
this.FadeOut(200, Easing.OutQuint);
} }
private void showFirstStep() private void showFirstStep()

View File

@ -390,7 +390,7 @@ namespace osu.Game.Skinning
return new LegacyJudgementPieceOld(resultComponent.Component, createDrawable); return new LegacyJudgementPieceOld(resultComponent.Component, createDrawable);
} }
break; return null;
} }
return this.GetAnimation(component.LookupName, false, false); return this.GetAnimation(component.LookupName, false, false);