1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-20 06:42:54 +08:00
osu-lazer/osu.Game/Screens/Edit/Verify/VerifyScreen.cs

137 lines
4.3 KiB
C#
Raw Normal View History

// 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;
using osu.Framework.Allocation;
2021-04-07 20:38:43 +08:00
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.Containers;
2021-04-07 20:38:43 +08:00
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
2021-04-07 20:38:43 +08:00
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
2021-04-07 20:38:43 +08:00
using osuTK;
namespace osu.Game.Screens.Edit.Verify
{
public class VerifyScreen : RoundedContentEditorScreen
{
[Cached]
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
public VerifyScreen()
: base(EditorScreenMode.Verify)
{
}
2021-04-07 20:38:43 +08:00
[BackgroundDependencyLoader]
private void load()
{
Child = new Container
{
2021-04-07 20:38:43 +08:00
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
{
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-04-07 20:38:43 +08:00
public class IssueList : CompositeDrawable
{
private IssueTable table;
[Resolved]
private EditorClock clock { get; set; }
[Resolved]
private IBindable<WorkingBeatmap> workingBeatmap { get; set; }
2021-04-18 07:15:13 +08:00
[Resolved]
private EditorBeatmap beatmap { get; set; }
[Resolved]
private Bindable<Issue> selectedIssue { get; set; }
private IBeatmapVerifier rulesetVerifier;
private BeatmapVerifier generalVerifier;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colours)
{
generalVerifier = new BeatmapVerifier();
2021-04-18 07:15:13 +08:00
rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier();
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new Box
{
Colour = colours.Background2,
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-04-07 20:38:43 +08:00
protected override void LoadComplete()
{
base.LoadComplete();
refresh();
}
private void refresh()
{
var issues = generalVerifier.Run(beatmap, workingBeatmap.Value);
if (rulesetVerifier != null)
issues = issues.Concat(rulesetVerifier.Run(beatmap, workingBeatmap.Value));
table.Issues = issues
.OrderBy(issue => issue.Template.Type)
.ThenBy(issue => issue.Check.Metadata.Category);
2021-04-07 20:38:43 +08:00
}
}
}
}