mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:32:55 +08:00
Improve UX and styling of external edit screen
This commit is contained in:
parent
118162c631
commit
74aa05fa6e
@ -1,4 +1,3 @@
|
|||||||
#nullable enable
|
|
||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// 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.Allocation;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
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
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
@ -22,36 +28,106 @@ namespace osu.Game.Screens.Edit
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost gameHost { get; set; } = null!;
|
private GameHost gameHost { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
private readonly Editor? editor;
|
private readonly Editor? editor;
|
||||||
|
|
||||||
|
private ExternalEditOperation<BeatmapSetInfo>? operation;
|
||||||
|
|
||||||
public ExternalEditScreen(Task<ExternalEditOperation<BeatmapSetInfo>> fileMountOperation, Editor editor)
|
public ExternalEditScreen(Task<ExternalEditOperation<BeatmapSetInfo>> fileMountOperation, Editor editor)
|
||||||
{
|
{
|
||||||
this.fileMountOperation = fileMountOperation;
|
this.fileMountOperation = fileMountOperation;
|
||||||
this.editor = editor;
|
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()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
fileMountOperation.ContinueWith(t =>
|
fileMountOperation.ContinueWith(t =>
|
||||||
{
|
{
|
||||||
var operation = t.GetResultSafely<ExternalEditOperation<BeatmapSetInfo>>();
|
operation = t.GetResultSafely();
|
||||||
|
Schedule(open);
|
||||||
// Ensure the trailing separator is present in order to show the folder contents.
|
|
||||||
gameHost.OpenFileExternally(operation.MountedPath.TrimDirectorySeparator() + Path.DirectorySeparatorChar);
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
private void open()
|
||||||
{
|
{
|
||||||
new SettingsButton
|
if (operation == null)
|
||||||
{
|
return;
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
// Ensure the trailing separator is present in order to show the folder contents.
|
||||||
Text = "end editing",
|
gameHost.OpenFileExternally(operation.MountedPath.TrimDirectorySeparator() + Path.DirectorySeparatorChar);
|
||||||
Action = finish,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finish()
|
private void finish()
|
||||||
|
Loading…
Reference in New Issue
Block a user