Update UI with new components

This commit is contained in:
Naxess
2021-04-07 14:38:43 +02:00
parent 9c4604e3c5
commit bab36e529a
4 changed files with 229 additions and 59 deletions

View File

@ -1,40 +1,70 @@
// 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.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osuTK;
namespace osu.Game.Screens.Edit.Verify
{
public class VerifyScreen : EditorScreenWithTimeline
public class VerifyScreen : EditorScreen
{
private Ruleset ruleset;
private static Checker checker; // TODO: Should not be static, but apparently needs to be?
public VerifyScreen()
: base(EditorScreenMode.Verify)
{
}
protected override Drawable CreateMainContent() => new GridContainer
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 200),
},
Content = new[]
{
new Drawable[]
{
new ControlPointList()
},
}
};
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
public class ControlPointList : CompositeDrawable
ruleset = parent.Get<IBindable<WorkingBeatmap>>().Value.BeatmapInfo.Ruleset?.CreateInstance();
checker = ruleset?.CreateChecker();
return dependencies;
}
[BackgroundDependencyLoader]
private void load()
{
Child = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(20),
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 200),
},
Content = new[]
{
new Drawable[]
{
new IssueList(),
new IssueSettings(),
},
}
}
};
}
public class IssueList : CompositeDrawable
{
private IssueTable table;
@ -60,9 +90,41 @@ namespace osu.Game.Screens.Edit.Verify
{
RelativeSizeAxes = Axes.Both,
Child = table = new IssueTable(),
}
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding(20),
Children = new Drawable[]
{
new TriangleButton
{
Text = "Refresh",
Action = refresh,
Size = new Vector2(120, 40),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
}
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
refresh();
}
private void refresh()
{
table.Issues = checker.Run(Beatmap)
.OrderByDescending(issue => issue.Template.Type)
.ThenByDescending(issue => issue.Template.Origin.Metadata().Category);
}
}
}
}