diff --git a/osu.Game/Screens/Edit/ExternalEditScreen.cs b/osu.Game/Screens/Edit/ExternalEditScreen.cs index 79a10c6292..047a4d442e 100644 --- a/osu.Game/Screens/Edit/ExternalEditScreen.cs +++ b/osu.Game/Screens/Edit/ExternalEditScreen.cs @@ -1,4 +1,3 @@ -#nullable enable // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. @@ -8,10 +7,17 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Overlays.Settings; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; +using osu.Game.Screens.OnlinePlay.Match.Components; +using osuTK; namespace osu.Game.Screens.Edit { @@ -22,36 +28,106 @@ namespace osu.Game.Screens.Edit [Resolved] private GameHost gameHost { get; set; } = null!; + [Resolved] + private OverlayColourProvider colourProvider { get; set; } = null!; + private readonly Editor? editor; + private ExternalEditOperation? operation; + public ExternalEditScreen(Task> fileMountOperation, Editor editor) { this.fileMountOperation = fileMountOperation; this.editor = editor; } + [BackgroundDependencyLoader] + private void load() + { + InternalChild = new Container + { + Masking = true, + CornerRadius = 20, + AutoSizeAxes = Axes.Both, + AutoSizeDuration = 500, + AutoSizeEasing = Easing.OutQuint, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + Colour = colourProvider.Background5, + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + Margin = new MarginPadding(20), + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Spacing = new Vector2(15), + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "Beatmap is mounted externally", + Font = OsuFont.Default.With(size: 30), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Spacing = new Vector2(15), + Children = new Drawable[] + { + } + }, + new PurpleRoundedButton + { + Text = "Open folder", + Width = 350, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = open, + }, + new DangerousRoundedButton + { + Text = "Finish editing and import changes", + Width = 350, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = finish, + } + } + } + } + }; + } + protected override void LoadComplete() { base.LoadComplete(); fileMountOperation.ContinueWith(t => { - var operation = t.GetResultSafely>(); - - // Ensure the trailing separator is present in order to show the folder contents. - gameHost.OpenFileExternally(operation.MountedPath.TrimDirectorySeparator() + Path.DirectorySeparatorChar); + operation = t.GetResultSafely(); + Schedule(open); }); + } - InternalChildren = new Drawable[] - { - new SettingsButton - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Text = "end editing", - Action = finish, - } - }; + private void open() + { + if (operation == null) + return; + + // Ensure the trailing separator is present in order to show the folder contents. + gameHost.OpenFileExternally(operation.MountedPath.TrimDirectorySeparator() + Path.DirectorySeparatorChar); } private void finish()