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