2021-07-06 06:20:58 +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;
|
2024-08-27 21:59:42 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-07-06 06:20:58 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2024-08-27 21:59:42 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Overlays;
|
2021-07-06 06:20:58 +08:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.UserInterfaceV2
|
|
|
|
{
|
|
|
|
internal partial class OsuDirectorySelectorBreadcrumbDisplay : DirectorySelectorBreadcrumbDisplay
|
|
|
|
{
|
2024-08-27 21:59:42 +08:00
|
|
|
public const float HEIGHT = 45;
|
|
|
|
public const float HORIZONTAL_PADDING = 20;
|
|
|
|
|
|
|
|
protected override Drawable CreateCaption() => Empty().With(d =>
|
2021-07-06 06:20:58 +08:00
|
|
|
{
|
2024-08-27 21:59:42 +08:00
|
|
|
d.Origin = Anchor.CentreLeft;
|
|
|
|
d.Anchor = Anchor.CentreLeft;
|
|
|
|
d.Alpha = 0;
|
|
|
|
});
|
2021-07-06 06:20:58 +08:00
|
|
|
|
|
|
|
protected override DirectorySelectorDirectory CreateRootDirectoryItem() => new OsuBreadcrumbDisplayComputer();
|
|
|
|
|
2024-08-27 22:01:49 +08:00
|
|
|
protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string? displayName = null) => new OsuBreadcrumbDisplayDirectory(directory, displayName);
|
2021-07-06 06:20:58 +08:00
|
|
|
|
2024-08-27 21:59:42 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2021-07-06 06:20:58 +08:00
|
|
|
{
|
2024-08-27 21:59:42 +08:00
|
|
|
((FillFlowContainer)InternalChild).Padding = new MarginPadding
|
|
|
|
{
|
|
|
|
Horizontal = HORIZONTAL_PADDING,
|
|
|
|
Vertical = 10,
|
|
|
|
};
|
|
|
|
|
|
|
|
AddInternal(new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = colourProvider.Background4,
|
|
|
|
Depth = 1,
|
|
|
|
});
|
2021-07-06 06:20:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private partial class OsuBreadcrumbDisplayComputer : OsuBreadcrumbDisplayDirectory
|
|
|
|
{
|
|
|
|
protected override IconUsage? Icon => null;
|
|
|
|
|
|
|
|
public OsuBreadcrumbDisplayComputer()
|
|
|
|
: base(null, "Computer")
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-27 21:59:42 +08:00
|
|
|
private partial class OsuBreadcrumbDisplayDirectory : DirectorySelectorDirectory
|
2021-07-06 06:20:58 +08:00
|
|
|
{
|
2024-08-27 22:01:49 +08:00
|
|
|
public OsuBreadcrumbDisplayDirectory(DirectoryInfo? directory, string? displayName = null)
|
2021-07-06 06:20:58 +08:00
|
|
|
: base(directory, displayName)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-08-27 21:59:42 +08:00
|
|
|
[Resolved]
|
2024-08-27 22:01:49 +08:00
|
|
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
2024-08-27 21:59:42 +08:00
|
|
|
|
2021-07-06 06:20:58 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2024-08-27 21:59:42 +08:00
|
|
|
Anchor = Anchor.CentreLeft;
|
|
|
|
Origin = Anchor.CentreLeft;
|
|
|
|
|
|
|
|
Flow.AutoSizeAxes = Axes.X;
|
|
|
|
Flow.Height = 25;
|
|
|
|
Flow.Margin = new MarginPadding { Horizontal = 10, };
|
|
|
|
|
|
|
|
AddRangeInternal(new Drawable[]
|
|
|
|
{
|
|
|
|
new Background
|
|
|
|
{
|
|
|
|
Depth = 1
|
|
|
|
},
|
|
|
|
new HoverClickSounds(),
|
|
|
|
});
|
|
|
|
|
2021-07-06 06:20:58 +08:00
|
|
|
Flow.Add(new SpriteIcon
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
Icon = FontAwesome.Solid.ChevronRight,
|
2024-08-27 21:59:42 +08:00
|
|
|
Size = new Vector2(FONT_SIZE / 2),
|
|
|
|
Margin = new MarginPadding { Left = 5, },
|
2021-07-06 06:20:58 +08:00
|
|
|
});
|
2024-08-27 21:59:42 +08:00
|
|
|
Flow.Colour = colourProvider.Light3;
|
2021-07-06 06:20:58 +08:00
|
|
|
}
|
|
|
|
|
2024-08-27 21:59:42 +08:00
|
|
|
protected override SpriteText CreateSpriteText() => new OsuSpriteText().With(t => t.Font = OsuFont.Default.With(weight: FontWeight.SemiBold));
|
|
|
|
|
|
|
|
protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar) ? FontAwesome.Solid.Database : null;
|
|
|
|
|
|
|
|
internal partial class Background : CompositeDrawable
|
|
|
|
{
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider overlayColourProvider)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
Masking = true;
|
|
|
|
CornerRadius = 5;
|
|
|
|
|
|
|
|
InternalChild = new Box
|
|
|
|
{
|
|
|
|
Colour = overlayColourProvider.Background3,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2021-07-06 06:20:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|