mirror of
https://github.com/ppy/osu.git
synced 2024-12-26 15:32:56 +08:00
65 lines
2.2 KiB
C#
65 lines
2.2 KiB
C#
|
// 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.Sprites;
|
||
|
using osu.Framework.Graphics.UserInterface;
|
||
|
using osu.Game.Graphics.Sprites;
|
||
|
using osuTK;
|
||
|
|
||
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||
|
{
|
||
|
internal class OsuDirectorySelectorBreadcrumbDisplay : DirectorySelectorBreadcrumbDisplay
|
||
|
{
|
||
|
protected override Drawable CreateCaption() => new OsuSpriteText
|
||
|
{
|
||
|
Text = "Current Directory: ",
|
||
|
Font = OsuFont.Default.With(size: OsuDirectorySelector.ITEM_HEIGHT),
|
||
|
};
|
||
|
|
||
|
protected override DirectorySelectorDirectory CreateRootDirectoryItem() => new OsuBreadcrumbDisplayComputer();
|
||
|
|
||
|
protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string displayName = null) => new OsuBreadcrumbDisplayDirectory(directory, displayName);
|
||
|
|
||
|
[BackgroundDependencyLoader]
|
||
|
private void load()
|
||
|
{
|
||
|
Height = 50;
|
||
|
}
|
||
|
|
||
|
private class OsuBreadcrumbDisplayComputer : OsuBreadcrumbDisplayDirectory
|
||
|
{
|
||
|
protected override IconUsage? Icon => null;
|
||
|
|
||
|
public OsuBreadcrumbDisplayComputer()
|
||
|
: base(null, "Computer")
|
||
|
{
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private class OsuBreadcrumbDisplayDirectory : OsuDirectorySelectorDirectory
|
||
|
{
|
||
|
public OsuBreadcrumbDisplayDirectory(DirectoryInfo directory, string displayName = null)
|
||
|
: base(directory, displayName)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
[BackgroundDependencyLoader]
|
||
|
private void load()
|
||
|
{
|
||
|
Flow.Add(new SpriteIcon
|
||
|
{
|
||
|
Anchor = Anchor.CentreLeft,
|
||
|
Origin = Anchor.CentreLeft,
|
||
|
Icon = FontAwesome.Solid.ChevronRight,
|
||
|
Size = new Vector2(FONT_SIZE / 2)
|
||
|
});
|
||
|
}
|
||
|
|
||
|
protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar) ? base.Icon : null;
|
||
|
}
|
||
|
}
|
||
|
}
|