1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-08 23:52:58 +08:00
osu-lazer/osu.Game/Overlays/FirstRunSetupOverlay.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
3.0 KiB
C#
Raw Normal View History

2022-04-06 16:42:10 +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.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
2022-05-16 18:21:26 +08:00
using osu.Game.Database;
2022-04-06 16:42:10 +08:00
using osu.Game.Graphics;
using osu.Game.Localisation;
2022-04-06 16:42:10 +08:00
using osu.Game.Overlays.FirstRunSetup;
using osu.Game.Overlays.Notifications;
2022-04-18 17:58:14 +08:00
using osu.Game.Screens;
2022-04-06 16:42:10 +08:00
using osu.Game.Screens.Menu;
namespace osu.Game.Overlays
{
[Cached]
public partial class FirstRunSetupOverlay : WizardOverlay
2022-04-06 16:42:10 +08:00
{
2022-04-18 17:58:14 +08:00
[Resolved]
private IPerformFromScreenRunner performer { get; set; } = null!;
[Resolved]
private INotificationOverlay notificationOverlay { get; set; } = null!;
[Resolved]
private OsuConfigManager config { get; set; } = null!;
private readonly Bindable<bool> showFirstRunSetup = new Bindable<bool>();
public FirstRunSetupOverlay()
: base(OverlayColourScheme.Purple)
{
}
2022-05-16 18:21:26 +08:00
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, LegacyImportManager? legacyImportManager)
2022-04-06 16:42:10 +08:00
{
AddStep<ScreenWelcome>();
AddStep<ScreenUIScale>();
AddStep<ScreenBeatmaps>();
2022-05-16 18:21:26 +08:00
if (legacyImportManager?.SupportsImportFromStable == true)
AddStep<ScreenImportFromStable>();
AddStep<ScreenBehaviour>();
2022-05-16 18:21:26 +08:00
Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle;
Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription;
2022-04-06 16:42:10 +08:00
}
protected override void LoadComplete()
{
base.LoadComplete();
config.BindWith(OsuSetting.ShowFirstRunSetup, showFirstRunSetup);
if (showFirstRunSetup.Value) Show();
2022-04-06 16:42:10 +08:00
}
public override void Show()
{
// if we are valid for display, only do so after reaching the main menu.
performer.PerformFromScreen(screen =>
{
// Hides the toolbar for us.
if (screen is MainMenu menu)
menu.ReturnToOsuLogo();
base.Show();
}, new[] { typeof(MainMenu) });
}
2022-04-06 16:42:10 +08:00
protected override void PopOut()
{
base.PopOut();
if (CurrentStepIndex != null)
{
notificationOverlay.Post(new SimpleNotification
{
Text = FirstRunSetupOverlayStrings.ClickToResumeFirstRunSetupAtAnyPoint,
Icon = FontAwesome.Solid.Redo,
Activated = () =>
{
Show();
return true;
},
});
}
}
protected override void ShowNextStep()
{
base.ShowNextStep();
if (CurrentStepIndex == null)
showFirstRunSetup.Value = false;
}
2022-04-06 16:42:10 +08:00
}
}