2021-05-12 07:27:21 +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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2021-05-13 11:46:47 +08:00
|
|
|
using osu.Framework.Bindables;
|
2021-05-12 07:27:21 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
using osu.Game.Overlays.Settings;
|
|
|
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Verify
|
|
|
|
{
|
2021-05-12 15:53:49 +08:00
|
|
|
internal class VisibilitySection : EditorRoundedScreenSettingsSection
|
2021-05-12 07:27:21 +08:00
|
|
|
{
|
2021-05-12 15:53:49 +08:00
|
|
|
[Resolved]
|
|
|
|
private VerifyScreen verify { get; set; }
|
2021-05-12 07:27:21 +08:00
|
|
|
|
2021-05-13 10:50:32 +08:00
|
|
|
private readonly IssueType[] configurableIssueTypes =
|
|
|
|
{
|
|
|
|
IssueType.Warning,
|
|
|
|
IssueType.Error,
|
|
|
|
IssueType.Negligible
|
|
|
|
};
|
|
|
|
|
2021-05-13 11:46:47 +08:00
|
|
|
private BindableList<IssueType> hiddenIssueTypes;
|
|
|
|
|
2021-05-12 07:27:21 +08:00
|
|
|
protected override string Header => "Visibility";
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider colours)
|
|
|
|
{
|
2021-05-13 11:46:47 +08:00
|
|
|
hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();
|
2021-05-13 11:25:20 +08:00
|
|
|
|
2021-05-13 10:50:32 +08:00
|
|
|
foreach (IssueType issueType in configurableIssueTypes)
|
2021-05-12 07:27:21 +08:00
|
|
|
{
|
|
|
|
var checkbox = new SettingsCheckbox
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
2021-05-13 12:08:48 +08:00
|
|
|
LabelText = issueType.ToString(),
|
|
|
|
Current = { Default = !hiddenIssueTypes.Contains(issueType) }
|
2021-05-12 07:27:21 +08:00
|
|
|
};
|
|
|
|
|
2021-05-13 10:50:32 +08:00
|
|
|
checkbox.Current.SetDefault();
|
|
|
|
checkbox.Current.BindValueChanged(state =>
|
|
|
|
{
|
|
|
|
if (!state.NewValue)
|
2021-05-13 11:25:20 +08:00
|
|
|
hiddenIssueTypes.Add(issueType);
|
2021-05-13 10:50:32 +08:00
|
|
|
else
|
2021-05-13 11:25:20 +08:00
|
|
|
hiddenIssueTypes.Remove(issueType);
|
2021-05-13 10:50:32 +08:00
|
|
|
});
|
|
|
|
|
2021-05-12 07:27:21 +08:00
|
|
|
Flow.Add(checkbox);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|