mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 19:22:58 +08:00
Improve general layout and allow overlay to be displayed without dependencies for now
This commit is contained in:
parent
c2df3465b2
commit
e064f2f23e
@ -2,14 +2,19 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Navigation
|
namespace osu.Game.Tests.Visual.Navigation
|
||||||
{
|
{
|
||||||
public class TestFirstRunSetup : OsuGameTestScene
|
public class TestFirstRunSetup : OsuTestScene
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOverlay()
|
public void TestOverlay()
|
||||||
{
|
{
|
||||||
|
AddStep("add overlay", () =>
|
||||||
|
{
|
||||||
|
Child = new FirstRunSetupOverlay();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.FirstRunSetup
|
namespace osu.Game.Overlays.FirstRunSetup
|
||||||
{
|
{
|
||||||
@ -22,9 +22,10 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuTextFlowContainer
|
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
|
||||||
{
|
{
|
||||||
Text = "Welcome to the first-run setup guide!\n\nThis will help you get osu! setup in a way that suits you.",
|
Text =
|
||||||
|
"Welcome to the first-run setup guide!\n\nosu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y
|
AutoSizeAxes = Axes.Y
|
||||||
},
|
},
|
||||||
@ -41,11 +42,5 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEntering(IScreen last)
|
|
||||||
{
|
|
||||||
base.OnEntering(last);
|
|
||||||
Overlay.MoveDisplayTo(new Vector2(0.5f));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,10 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Overlays.FirstRunSetup;
|
using osu.Game.Overlays.FirstRunSetup;
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -26,18 +26,17 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
protected override bool StartHidden => true;
|
protected override bool StartHidden => true;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(canBeNull: true)]
|
||||||
private DialogOverlay dialogOverlay { get; set; }
|
private DialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(canBeNull: true)]
|
||||||
private OsuGame osuGame { get; set; }
|
private OsuGame osuGame { get; set; }
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||||
|
|
||||||
private ScreenWelcome welcomeScreen;
|
private ScreenWelcome welcomeScreen;
|
||||||
|
|
||||||
private Container currentDisplayContainer;
|
|
||||||
|
|
||||||
private PlayfieldBorder border;
|
|
||||||
|
|
||||||
public FirstRunSetupOverlay()
|
public FirstRunSetupOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -48,18 +47,12 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
border = new PlayfieldBorder
|
new Container
|
||||||
{
|
{
|
||||||
PlayfieldBorderStyle = { Value = PlayfieldBorderStyle.Full },
|
|
||||||
Colour = colours.Blue,
|
|
||||||
},
|
|
||||||
currentDisplayContainer = new Container
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativePositionAxes = Axes.Both,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(0.5f),
|
Anchor = Anchor.Centre,
|
||||||
Position = new Vector2(0.5f),
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(0.95f),
|
||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
@ -73,12 +66,68 @@ namespace osu.Game.Overlays
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = colourProvider.Background5,
|
||||||
Alpha = 0.8f,
|
|
||||||
},
|
},
|
||||||
new ScreenStack(welcomeScreen = new ScreenWelcome())
|
new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RowDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
new Dimension(),
|
||||||
|
},
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = colourProvider.Background6,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Margin = new MarginPadding(10),
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "First run setup",
|
||||||
|
Font = OsuFont.Default.With(size: 32),
|
||||||
|
Colour = colourProvider.Content2,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
},
|
||||||
|
new OsuTextFlowContainer
|
||||||
|
{
|
||||||
|
Text = "Setup osu! to suit you",
|
||||||
|
Colour = colourProvider.Content1,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
new ScreenStack(welcomeScreen = new ScreenWelcome())
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,24 +138,25 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
// if we are valid for display, only do so after reaching the main menu.
|
if (osuGame != null)
|
||||||
osuGame.PerformFromScreen(_ =>
|
{
|
||||||
|
// if we are valid for display, only do so after reaching the main menu.
|
||||||
|
osuGame.PerformFromScreen(_ =>
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
}, new[] { typeof(MainMenu) });
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
}, new[] { typeof(MainMenu) });
|
}
|
||||||
|
|
||||||
border
|
|
||||||
.FadeInFromZero(500)
|
|
||||||
.Delay(1000)
|
|
||||||
.FadeOut(500)
|
|
||||||
.Loop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (dialogOverlay.CurrentDialog == null)
|
if (dialogOverlay?.CurrentDialog == null)
|
||||||
{
|
{
|
||||||
dialogOverlay.Push(new ConfirmDialog("Are you sure you want to exit the setup process?",
|
dialogOverlay?.Push(new ConfirmDialog("Are you sure you want to exit the setup process?",
|
||||||
Hide,
|
Hide,
|
||||||
() => { }));
|
() => { }));
|
||||||
}
|
}
|
||||||
@ -128,11 +178,5 @@ namespace osu.Game.Overlays
|
|||||||
base.PopOut();
|
base.PopOut();
|
||||||
this.FadeOut(100);
|
this.FadeOut(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveDisplayTo(Vector2 position) =>
|
|
||||||
currentDisplayContainer.MoveTo(position, 1000, Easing.OutElasticQuarter);
|
|
||||||
|
|
||||||
public void ResizeDisplayTo(Vector2 scale) =>
|
|
||||||
currentDisplayContainer.ScaleTo(scale, 1000, Easing.OutElasticQuarter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user