A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4using System.IO;
5using osu.Framework.Allocation;
6using osu.Framework.Graphics.Sprites;
7using osuTK;
8
9namespace osu.Framework.Graphics.UserInterface
10{
11 public class BasicDirectorySelectorBreadcrumbDisplay : DirectorySelectorBreadcrumbDisplay
12 {
13 protected override Drawable CreateCaption() => new SpriteText
14 {
15 Text = "Current Directory:",
16 Font = FrameworkFont.Condensed.With(size: 20),
17 Anchor = Anchor.CentreLeft,
18 Origin = Anchor.CentreLeft
19 };
20
21 protected override DirectorySelectorDirectory CreateRootDirectoryItem() => new BreadcrumbDisplayComputer();
22
23 protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string displayName = null) => new BreadcrumbDisplayDirectory(directory, displayName);
24
25 public BasicDirectorySelectorBreadcrumbDisplay()
26 {
27 RelativeSizeAxes = Axes.X;
28 AutoSizeAxes = Axes.Y;
29 }
30
31 protected class BreadcrumbDisplayComputer : BreadcrumbDisplayDirectory
32 {
33 protected override IconUsage? Icon => null;
34
35 public BreadcrumbDisplayComputer()
36 : base(null, "Computer")
37 {
38 }
39 }
40
41 protected class BreadcrumbDisplayDirectory : BasicDirectorySelectorDirectory
42 {
43 protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar) ? base.Icon : null;
44
45 public BreadcrumbDisplayDirectory(DirectoryInfo directory, string displayName = null)
46 : base(directory, displayName)
47 {
48 }
49
50 [BackgroundDependencyLoader]
51 private void load()
52 {
53 Flow.Add(new SpriteIcon
54 {
55 Anchor = Anchor.CentreLeft,
56 Origin = Anchor.CentreLeft,
57 Icon = FontAwesome.Solid.ChevronRight,
58 Size = new Vector2(FONT_SIZE / 2)
59 });
60 }
61 }
62 }
63}