2021-05-12 07:23:31 +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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-05-12 07:23:31 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
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.Containers;
|
2022-05-24 15:02:08 +08:00
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
2021-05-12 07:23:31 +08:00
|
|
|
using osu.Game.Overlays;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Verify
|
|
|
|
{
|
2021-05-12 15:53:49 +08:00
|
|
|
[Cached]
|
2021-05-12 07:23:31 +08:00
|
|
|
public class IssueList : CompositeDrawable
|
|
|
|
{
|
|
|
|
private IssueTable table;
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private IBindable<WorkingBeatmap> workingBeatmap { get; set; }
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private EditorBeatmap beatmap { get; set; }
|
|
|
|
|
|
|
|
[Resolved]
|
2021-05-12 15:53:49 +08:00
|
|
|
private VerifyScreen verify { get; set; }
|
2021-05-12 07:32:18 +08:00
|
|
|
|
2021-05-12 07:23:31 +08:00
|
|
|
private IBeatmapVerifier rulesetVerifier;
|
|
|
|
private BeatmapVerifier generalVerifier;
|
2021-05-12 08:29:18 +08:00
|
|
|
private BeatmapVerifierContext context;
|
2021-05-12 07:23:31 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider colours)
|
|
|
|
{
|
|
|
|
generalVerifier = new BeatmapVerifier();
|
2022-01-04 13:35:18 +08:00
|
|
|
rulesetVerifier = beatmap.BeatmapInfo.Ruleset.CreateInstance().CreateBeatmapVerifier();
|
2021-05-12 07:23:31 +08:00
|
|
|
|
2021-05-13 17:24:22 +08:00
|
|
|
context = new BeatmapVerifierContext(beatmap, workingBeatmap.Value, verify.InterpretedDifficulty.Value);
|
2021-05-14 15:24:52 +08:00
|
|
|
verify.InterpretedDifficulty.BindValueChanged(difficulty => context.InterpretedDifficulty = difficulty.NewValue);
|
2021-05-12 08:29:18 +08:00
|
|
|
|
2021-05-12 07:23:31 +08:00
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
2022-05-28 07:10:18 +08:00
|
|
|
Colour = colours.Background3,
|
2021-05-12 07:23:31 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
new OsuScrollContainer
|
|
|
|
{
|
|
|
|
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[]
|
|
|
|
{
|
2022-05-24 15:02:08 +08:00
|
|
|
new RoundedButton
|
2021-05-12 07:23:31 +08:00
|
|
|
{
|
|
|
|
Text = "Refresh",
|
2021-05-13 11:25:02 +08:00
|
|
|
Action = refresh,
|
2021-05-12 07:23:31 +08:00
|
|
|
Size = new Vector2(120, 40),
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
Origin = Anchor.BottomRight,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2021-05-13 12:00:21 +08:00
|
|
|
verify.InterpretedDifficulty.BindValueChanged(_ => refresh());
|
2022-06-24 20:25:23 +08:00
|
|
|
verify.HiddenIssueTypes.BindCollectionChanged((_, _) => refresh());
|
2021-05-13 12:00:21 +08:00
|
|
|
|
|
|
|
refresh();
|
2021-05-12 07:23:31 +08:00
|
|
|
}
|
|
|
|
|
2021-05-13 11:25:02 +08:00
|
|
|
private void refresh()
|
2021-05-12 07:23:31 +08:00
|
|
|
{
|
2021-05-13 17:24:22 +08:00
|
|
|
var issues = generalVerifier.Run(context);
|
2021-05-12 07:23:31 +08:00
|
|
|
|
|
|
|
if (rulesetVerifier != null)
|
2021-05-13 17:24:22 +08:00
|
|
|
issues = issues.Concat(rulesetVerifier.Run(context));
|
2021-05-12 07:23:31 +08:00
|
|
|
|
2021-05-12 07:29:46 +08:00
|
|
|
issues = filter(issues);
|
|
|
|
|
2021-05-12 07:23:31 +08:00
|
|
|
table.Issues = issues
|
|
|
|
.OrderBy(issue => issue.Template.Type)
|
|
|
|
.ThenBy(issue => issue.Check.Metadata.Category);
|
|
|
|
}
|
2021-05-12 07:29:46 +08:00
|
|
|
|
|
|
|
private IEnumerable<Issue> filter(IEnumerable<Issue> issues)
|
|
|
|
{
|
2021-05-13 10:50:32 +08:00
|
|
|
return issues.Where(issue => !verify.HiddenIssueTypes.Contains(issue.Template.Type));
|
2021-05-12 07:29:46 +08:00
|
|
|
}
|
2021-05-12 07:23:31 +08:00
|
|
|
}
|
|
|
|
}
|