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;
|
2022-04-19 15:59:25 +08:00
|
|
|
using osu.Framework.Bindables;
|
2022-04-18 18:36:12 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2022-04-19 15:59:25 +08:00
|
|
|
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;
|
2022-04-19 12:52:55 +08:00
|
|
|
using osu.Game.Localisation;
|
2022-04-06 16:42:10 +08:00
|
|
|
using osu.Game.Overlays.FirstRunSetup;
|
2022-04-18 18:36:12 +08:00
|
|
|
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]
|
2024-10-17 17:04:39 +08:00
|
|
|
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!;
|
2022-04-18 15:07:30 +08:00
|
|
|
|
2022-04-18 18:47:47 +08:00
|
|
|
[Resolved]
|
|
|
|
private INotificationOverlay notificationOverlay { get; set; } = null!;
|
2022-04-18 18:36:12 +08:00
|
|
|
|
2022-04-19 15:59:25 +08:00
|
|
|
[Resolved]
|
|
|
|
private OsuConfigManager config { get; set; } = null!;
|
|
|
|
|
|
|
|
private readonly Bindable<bool> showFirstRunSetup = new Bindable<bool>();
|
|
|
|
|
2022-05-05 04:17:40 +08:00
|
|
|
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
|
|
|
{
|
2024-10-17 17:04:39 +08:00
|
|
|
AddStep<ScreenWelcome>();
|
|
|
|
AddStep<ScreenUIScale>();
|
|
|
|
AddStep<ScreenBeatmaps>();
|
2022-05-16 18:21:26 +08:00
|
|
|
if (legacyImportManager?.SupportsImportFromStable == true)
|
2024-10-17 17:04:39 +08:00
|
|
|
AddStep<ScreenImportFromStable>();
|
|
|
|
AddStep<ScreenBehaviour>();
|
2022-05-16 18:21:26 +08:00
|
|
|
|
2022-04-23 06:31:36 +08:00
|
|
|
Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle;
|
|
|
|
Header.Description = FirstRunSetupOverlayStrings.FirstRunSetupDescription;
|
2022-04-06 16:42:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2022-04-19 15:59:25 +08:00
|
|
|
config.BindWith(OsuSetting.ShowFirstRunSetup, showFirstRunSetup);
|
|
|
|
|
2022-05-10 15:43:38 +08:00
|
|
|
if (showFirstRunSetup.Value) Show();
|
2022-04-06 16:42:10 +08:00
|
|
|
}
|
|
|
|
|
2022-04-19 16:40:35 +08:00
|
|
|
public override void Show()
|
|
|
|
{
|
|
|
|
// if we are valid for display, only do so after reaching the main menu.
|
|
|
|
performer.PerformFromScreen(screen =>
|
|
|
|
{
|
2022-05-19 15:42:43 +08:00
|
|
|
// Hides the toolbar for us.
|
|
|
|
if (screen is MainMenu menu)
|
|
|
|
menu.ReturnToOsuLogo();
|
2022-04-19 16:40:35 +08:00
|
|
|
|
|
|
|
base.Show();
|
|
|
|
}, new[] { typeof(MainMenu) });
|
|
|
|
}
|
|
|
|
|
2022-04-06 16:42:10 +08:00
|
|
|
protected override void PopOut()
|
|
|
|
{
|
2022-04-20 15:51:26 +08:00
|
|
|
base.PopOut();
|
|
|
|
|
2024-10-17 17:04:39 +08:00
|
|
|
if (CurrentStepIndex != null)
|
2022-04-18 18:35:51 +08:00
|
|
|
{
|
2022-04-18 18:47:47 +08:00
|
|
|
notificationOverlay.Post(new SimpleNotification
|
2022-04-18 18:35:51 +08:00
|
|
|
{
|
2022-04-19 12:52:55 +08:00
|
|
|
Text = FirstRunSetupOverlayStrings.ClickToResumeFirstRunSetupAtAnyPoint,
|
2022-04-21 11:18:54 +08:00
|
|
|
Icon = FontAwesome.Solid.Redo,
|
2022-04-18 18:35:51 +08:00
|
|
|
Activated = () =>
|
|
|
|
{
|
|
|
|
Show();
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2022-04-19 13:46:01 +08:00
|
|
|
}
|
|
|
|
|
2024-10-17 17:04:39 +08:00
|
|
|
protected override void ShowNextStep()
|
2022-04-19 13:46:01 +08:00
|
|
|
{
|
2024-10-17 17:04:39 +08:00
|
|
|
base.ShowNextStep();
|
2022-05-10 17:04:10 +08:00
|
|
|
|
2024-10-17 17:04:39 +08:00
|
|
|
if (CurrentStepIndex == null)
|
2022-05-10 15:43:38 +08:00
|
|
|
showFirstRunSetup.Value = false;
|
2022-04-19 13:46:01 +08:00
|
|
|
}
|
2022-04-06 16:42:10 +08:00
|
|
|
}
|
|
|
|
}
|