2021-03-28 23:36:22 +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.
|
|
|
|
|
2021-04-07 20:38:43 +08:00
|
|
|
using System.Linq;
|
2021-03-28 23:36:22 +08:00
|
|
|
using osu.Framework.Allocation;
|
2021-04-07 20:38:43 +08:00
|
|
|
using osu.Framework.Bindables;
|
2021-03-28 23:36:22 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Containers;
|
2021-04-07 20:38:43 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
2021-04-10 19:04:39 +08:00
|
|
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
2021-04-07 20:38:43 +08:00
|
|
|
using osuTK;
|
2021-03-28 23:36:22 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Verify
|
|
|
|
{
|
2021-04-07 20:38:43 +08:00
|
|
|
public class VerifyScreen : EditorScreen
|
2021-03-28 23:36:22 +08:00
|
|
|
{
|
2021-04-10 19:04:39 +08:00
|
|
|
[Cached]
|
|
|
|
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
|
|
|
|
|
2021-03-28 23:36:22 +08:00
|
|
|
public VerifyScreen()
|
|
|
|
: base(EditorScreenMode.Verify)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-04-07 20:38:43 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
Child = new Container
|
2021-03-28 23:36:22 +08:00
|
|
|
{
|
2021-04-07 20:38:43 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Padding = new MarginPadding(20),
|
|
|
|
Child = new GridContainer
|
2021-03-28 23:36:22 +08:00
|
|
|
{
|
2021-04-07 20:38:43 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 200),
|
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new IssueList(),
|
|
|
|
new IssueSettings(),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2021-03-28 23:36:22 +08:00
|
|
|
|
2021-04-07 20:38:43 +08:00
|
|
|
public class IssueList : CompositeDrawable
|
2021-03-28 23:36:22 +08:00
|
|
|
{
|
|
|
|
private IssueTable table;
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private EditorClock clock { get; set; }
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
protected EditorBeatmap Beatmap { get; private set; }
|
|
|
|
|
2021-04-10 19:04:39 +08:00
|
|
|
[Resolved]
|
|
|
|
private Bindable<Issue> selectedIssue { get; set; }
|
|
|
|
|
2021-04-13 18:50:22 +08:00
|
|
|
private IBeatmapVerifier rulesetVerifier;
|
|
|
|
private BeatmapVerifier generalVerifier;
|
|
|
|
|
2021-03-28 23:36:22 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
2021-04-13 18:50:22 +08:00
|
|
|
generalVerifier = new BeatmapVerifier();
|
|
|
|
rulesetVerifier = Beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier();
|
|
|
|
|
2021-03-28 23:36:22 +08:00
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
Colour = colours.Gray0,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
new OsuScrollContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Child = table = new IssueTable(),
|
2021-04-07 20:38:43 +08:00
|
|
|
},
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2021-03-28 23:36:22 +08:00
|
|
|
};
|
|
|
|
}
|
2021-04-07 20:38:43 +08:00
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void refresh()
|
|
|
|
{
|
2021-04-13 18:50:22 +08:00
|
|
|
var issues = generalVerifier.Run(Beatmap);
|
|
|
|
|
|
|
|
if (rulesetVerifier != null)
|
|
|
|
issues = issues.Concat(rulesetVerifier.Run(Beatmap));
|
|
|
|
|
|
|
|
table.Issues = issues
|
|
|
|
.OrderBy(issue => issue.Template.Type)
|
|
|
|
.ThenBy(issue => issue.Check.Metadata.Category);
|
2021-04-07 20:38:43 +08:00
|
|
|
}
|
2021-03-28 23:36:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|