2021-07-06 06:15:17 +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 System.IO;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2024-08-27 21:59:42 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-07-06 06:15:17 +08:00
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
using osu.Game.Graphics.Containers;
|
2024-08-27 21:59:42 +08:00
|
|
|
using osu.Game.Overlays;
|
2021-07-06 06:15:17 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Graphics.UserInterfaceV2
|
|
|
|
{
|
|
|
|
public partial class OsuDirectorySelector : DirectorySelector
|
|
|
|
{
|
2024-08-27 21:59:42 +08:00
|
|
|
public const float ITEM_HEIGHT = 16;
|
|
|
|
|
|
|
|
private Box hiddenToggleBackground = null!;
|
2021-07-06 06:15:17 +08:00
|
|
|
|
2024-08-27 22:01:49 +08:00
|
|
|
public OsuDirectorySelector(string? initialPath = null)
|
2021-07-06 06:15:17 +08:00
|
|
|
: base(initialPath)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2024-08-27 21:59:42 +08:00
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2021-07-06 06:15:17 +08:00
|
|
|
{
|
2024-08-27 21:59:42 +08:00
|
|
|
AddInternal(new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = colourProvider.Background5,
|
|
|
|
Depth = float.MaxValue,
|
|
|
|
});
|
|
|
|
|
|
|
|
hiddenToggleBackground.Colour = colourProvider.Background4;
|
2021-07-06 06:15:17 +08:00
|
|
|
}
|
|
|
|
|
2024-08-27 21:59:42 +08:00
|
|
|
protected override ScrollContainer<Drawable> CreateScrollContainer() => new OsuScrollContainer
|
|
|
|
{
|
|
|
|
Padding = new MarginPadding
|
|
|
|
{
|
|
|
|
Horizontal = 20,
|
|
|
|
Vertical = 15,
|
|
|
|
}
|
|
|
|
};
|
2021-07-06 06:15:17 +08:00
|
|
|
|
|
|
|
protected override DirectorySelectorBreadcrumbDisplay CreateBreadcrumb() => new OsuDirectorySelectorBreadcrumbDisplay();
|
|
|
|
|
2024-08-27 21:59:42 +08:00
|
|
|
protected override Drawable CreateHiddenToggleButton() => new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
hiddenToggleBackground = new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
new OsuDirectorySelectorHiddenToggle
|
|
|
|
{
|
|
|
|
Current = { BindTarget = ShowHiddenItems },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2022-07-09 03:49:10 +08:00
|
|
|
|
2021-07-06 06:15:17 +08:00
|
|
|
protected override DirectorySelectorDirectory CreateParentDirectoryItem(DirectoryInfo directory) => new OsuDirectorySelectorParentDirectory(directory);
|
|
|
|
|
2024-08-27 22:01:49 +08:00
|
|
|
protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string? displayName = null) => new OsuDirectorySelectorDirectory(directory, displayName);
|
2021-07-06 06:15:17 +08:00
|
|
|
|
|
|
|
protected override void NotifySelectionError() => this.FlashColour(Colour4.Red, 300);
|
|
|
|
}
|
|
|
|
}
|