From 97bd482d4dae632548438ec05315ac37aec8c8fa Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:21:38 +0200 Subject: [PATCH 01/28] Factor out `load` from settings into new `Settings` class --- osu.Game/Screens/Edit/Settings.cs | 44 +++++++++++++++++++ .../Edit/Timing/ControlPointSettings.cs | 35 +-------------- osu.Game/Screens/Edit/Verify/IssueSettings.cs | 32 +------------- 3 files changed, 48 insertions(+), 63 deletions(-) create mode 100644 osu.Game/Screens/Edit/Settings.cs diff --git a/osu.Game/Screens/Edit/Settings.cs b/osu.Game/Screens/Edit/Settings.cs new file mode 100644 index 0000000000..758414333d --- /dev/null +++ b/osu.Game/Screens/Edit/Settings.cs @@ -0,0 +1,44 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Containers; +using osu.Game.Overlays; + +namespace osu.Game.Screens.Edit +{ + public abstract class Settings : CompositeDrawable + { + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colours) + { + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new Box + { + Colour = colours.Background4, + RelativeSizeAxes = Axes.Both, + }, + new OsuScrollContainer + { + RelativeSizeAxes = Axes.Both, + Child = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = CreateSections() + }, + } + }; + } + + protected abstract IReadOnlyList CreateSections(); + } +} diff --git a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs index 921fa675b3..36f31d4be4 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs @@ -2,44 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics.Containers; -using osu.Game.Overlays; namespace osu.Game.Screens.Edit.Timing { - public class ControlPointSettings : CompositeDrawable + public class ControlPointSettings : Settings { - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colours) - { - RelativeSizeAxes = Axes.Both; - - InternalChildren = new Drawable[] - { - new Box - { - Colour = colours.Background4, - RelativeSizeAxes = Axes.Both, - }, - new OsuScrollContainer - { - RelativeSizeAxes = Axes.Both, - Child = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = createSections() - }, - } - }; - } - - private IReadOnlyList createSections() => new Drawable[] + protected override IReadOnlyList CreateSections() => new Drawable[] { new GroupSection(), new TimingSection(), diff --git a/osu.Game/Screens/Edit/Verify/IssueSettings.cs b/osu.Game/Screens/Edit/Verify/IssueSettings.cs index 4519231cd2..15fc54d64f 100644 --- a/osu.Game/Screens/Edit/Verify/IssueSettings.cs +++ b/osu.Game/Screens/Edit/Verify/IssueSettings.cs @@ -2,44 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Edit.Verify { - public class IssueSettings : CompositeDrawable + public class IssueSettings : Settings { - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - RelativeSizeAxes = Axes.Both; - InternalChildren = new Drawable[] - { - new Box - { - Colour = colours.Gray3, - RelativeSizeAxes = Axes.Both, - }, - new OsuScrollContainer - { - RelativeSizeAxes = Axes.Both, - Child = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = createSections() - }, - } - }; } - private IReadOnlyList createSections() => new Drawable[] + protected override IReadOnlyList CreateSections() => new Drawable[] { }; } From d3c1ec55eec7399ea8405d1f39ee92a6f9b2fca6 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:22:32 +0200 Subject: [PATCH 02/28] Take `IssueList` in `IssueSettings` constructor We'll be using this for bindables later. --- osu.Game/Screens/Edit/Verify/IssueSettings.cs | 4 ++++ osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueSettings.cs b/osu.Game/Screens/Edit/Verify/IssueSettings.cs index 15fc54d64f..be06700b28 100644 --- a/osu.Game/Screens/Edit/Verify/IssueSettings.cs +++ b/osu.Game/Screens/Edit/Verify/IssueSettings.cs @@ -8,7 +8,11 @@ namespace osu.Game.Screens.Edit.Verify { public class IssueSettings : Settings { + private readonly IssueList issueList; + public IssueSettings(IssueList issueList) + { + this.issueList = issueList; } protected override IReadOnlyList CreateSections() => new Drawable[] diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index 9de1f04271..9fb81a6681 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -30,6 +30,8 @@ namespace osu.Game.Screens.Edit.Verify [BackgroundDependencyLoader] private void load() { + IssueList issueList; + Child = new Container { RelativeSizeAxes = Axes.Both, @@ -45,8 +47,8 @@ namespace osu.Game.Screens.Edit.Verify { new Drawable[] { - new IssueList(), - new IssueSettings(), + issueList = new IssueList(), + new IssueSettings(issueList), }, } } From 1de35f880b8b571e7aa89c597c69a8dcd1dd8dde Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:23:31 +0200 Subject: [PATCH 03/28] Separate `IssueList` into own class --- osu.Game/Screens/Edit/Verify/IssueList.cs | 100 +++++++++++++++++++ osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 88 ---------------- 2 files changed, 100 insertions(+), 88 deletions(-) create mode 100644 osu.Game/Screens/Edit/Verify/IssueList.cs diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs new file mode 100644 index 0000000000..6d319eb09e --- /dev/null +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -0,0 +1,100 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +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; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Checks.Components; +using osuTK; + +namespace osu.Game.Screens.Edit.Verify +{ + public class IssueList : CompositeDrawable + { + private IssueTable table; + + [Resolved] + private EditorClock clock { get; set; } + + [Resolved] + private IBindable workingBeatmap { get; set; } + + [Resolved] + private EditorBeatmap beatmap { get; set; } + + [Resolved] + private Bindable selectedIssue { get; set; } + + private IBeatmapVerifier rulesetVerifier; + private BeatmapVerifier generalVerifier; + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colours) + { + generalVerifier = new BeatmapVerifier(); + 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(), + }, + 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, + }, + } + }, + }; + } + + 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); + } + } +} diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index 9fb81a6681..ed4658da8e 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -1,19 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -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; -using osu.Game.Graphics.UserInterface; -using osu.Game.Overlays; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Checks.Components; -using osuTK; namespace osu.Game.Screens.Edit.Verify { @@ -54,85 +46,5 @@ namespace osu.Game.Screens.Edit.Verify } }; } - - public class IssueList : CompositeDrawable - { - private IssueTable table; - - [Resolved] - private EditorClock clock { get; set; } - - [Resolved] - private IBindable workingBeatmap { get; set; } - - [Resolved] - private EditorBeatmap beatmap { get; set; } - - [Resolved] - private Bindable selectedIssue { get; set; } - - private IBeatmapVerifier rulesetVerifier; - private BeatmapVerifier generalVerifier; - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colours) - { - generalVerifier = new BeatmapVerifier(); - 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(), - }, - 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, - }, - } - }, - }; - } - - 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); - } - } } } From 01b87947579c417395458c2832ba730d331d6e6b Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:26:12 +0200 Subject: [PATCH 04/28] Add abstract `Section` class Similar to `Section` in the timing screen, but does not make use of checkboxes, nor specific to control points. So there's a lot of things that differ, hence new class instead of factoring that out. --- osu.Game/Screens/Edit/Verify/Section.cs | 67 +++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 osu.Game/Screens/Edit/Verify/Section.cs diff --git a/osu.Game/Screens/Edit/Verify/Section.cs b/osu.Game/Screens/Edit/Verify/Section.cs new file mode 100644 index 0000000000..f6815a05a1 --- /dev/null +++ b/osu.Game/Screens/Edit/Verify/Section.cs @@ -0,0 +1,67 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osuTK; + +namespace osu.Game.Screens.Edit.Verify +{ + public abstract class Section : CompositeDrawable + { + private const int header_height = 50; + + protected readonly IssueList IssueList; + + protected FillFlowContainer Flow; + protected abstract string Header { get; } + + protected Section(IssueList issueList) + { + IssueList = issueList; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colours) + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Masking = true; + + InternalChildren = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = header_height, + Padding = new MarginPadding { Horizontal = 20 }, + Child = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = Header, + Font = new FontUsage(size: 25, weight: "bold") + } + }, + new Container + { + Y = header_height, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Child = Flow = new FillFlowContainer + { + Padding = new MarginPadding { Horizontal = 20 }, + Spacing = new Vector2(10), + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + } + } + }; + } + } +} From 2e4399f0c1f4bcb5cc66bf755f0e4954ab5c6b66 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:27:21 +0200 Subject: [PATCH 05/28] Add `VisibilitySection` and its bindables in `IssueList` --- osu.Game/Screens/Edit/Verify/IssueList.cs | 10 +++++ osu.Game/Screens/Edit/Verify/IssueSettings.cs | 1 + .../Screens/Edit/Verify/VisibilitySection.cs | 38 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 osu.Game/Screens/Edit/Verify/VisibilitySection.cs diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 6d319eb09e..dd1dffcb42 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -34,12 +34,22 @@ namespace osu.Game.Screens.Edit.Verify [Resolved] private Bindable selectedIssue { get; set; } + public Dictionary> ShowType { get; set; } + private IBeatmapVerifier rulesetVerifier; private BeatmapVerifier generalVerifier; [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { + // Reflects the user interface. Only types in this dictionary have configurable visibility. + ShowType = new Dictionary> + { + { IssueType.Warning, new Bindable(true) }, + { IssueType.Error, new Bindable(true) }, + { IssueType.Negligible, new Bindable(false) } + }; + generalVerifier = new BeatmapVerifier(); rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier(); diff --git a/osu.Game/Screens/Edit/Verify/IssueSettings.cs b/osu.Game/Screens/Edit/Verify/IssueSettings.cs index be06700b28..0df3ab0dcb 100644 --- a/osu.Game/Screens/Edit/Verify/IssueSettings.cs +++ b/osu.Game/Screens/Edit/Verify/IssueSettings.cs @@ -17,6 +17,7 @@ namespace osu.Game.Screens.Edit.Verify protected override IReadOnlyList CreateSections() => new Drawable[] { + new VisibilitySection(issueList) }; } } diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs new file mode 100644 index 0000000000..e9fa9b56ed --- /dev/null +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -0,0 +1,38 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +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 +{ + internal class VisibilitySection : Section + { + public VisibilitySection(IssueList issueList) + : base(issueList) + { + } + + protected override string Header => "Visibility"; + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colours) + { + foreach (IssueType issueType in IssueList.ShowType.Keys) + { + var checkbox = new SettingsCheckbox + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + LabelText = issueType.ToString() + }; + + checkbox.Current.BindTo(IssueList.ShowType[issueType]); + Flow.Add(checkbox); + } + } + } +} From 1bb7d412daf2ad534dcb3a09161f459fb698e535 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:29:46 +0200 Subject: [PATCH 06/28] Add `IssueList` filtering based on those bindables --- osu.Game/Screens/Edit/Verify/IssueList.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index dd1dffcb42..7a2202c198 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -102,9 +102,22 @@ namespace osu.Game.Screens.Edit.Verify if (rulesetVerifier != null) issues = issues.Concat(rulesetVerifier.Run(beatmap, workingBeatmap.Value)); + issues = filter(issues); + table.Issues = issues .OrderBy(issue => issue.Template.Type) .ThenBy(issue => issue.Check.Metadata.Category); } + + private IEnumerable filter(IEnumerable issues) + { + foreach (IssueType issueType in ShowType.Keys) + { + if (!ShowType[issueType].Value) + issues = issues.Where(issue => issue.Template.Type != issueType); + } + + return issues; + } } } From ad78aec1ef8380db80d9e57eb495fa3be2aa2c38 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:30:45 +0200 Subject: [PATCH 07/28] Refresh `IssueList` on changes in `VisibilitySection` --- osu.Game/Screens/Edit/Verify/IssueList.cs | 6 +++--- osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 7a2202c198..b7a6d769e3 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Edit.Verify new TriangleButton { Text = "Refresh", - Action = refresh, + Action = Refresh, Size = new Vector2(120, 40), Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -92,10 +92,10 @@ namespace osu.Game.Screens.Edit.Verify { base.LoadComplete(); - refresh(); + Refresh(); } - private void refresh() + public void Refresh() { var issues = generalVerifier.Run(beatmap, workingBeatmap.Value); diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index e9fa9b56ed..f849426800 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Edit.Verify }; checkbox.Current.BindTo(IssueList.ShowType[issueType]); + checkbox.Current.BindValueChanged(_ => IssueList.Refresh()); Flow.Add(checkbox); } } From 75adec57ebfa8aaefcb124d3c802e2e8f69ee0a4 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:31:16 +0200 Subject: [PATCH 08/28] Remove negligible default hidden TODO --- osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs b/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs index 1241e058ad..1f708209fe 100644 --- a/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs +++ b/osu.Game/Rulesets/Edit/Checks/Components/IssueType.cs @@ -18,7 +18,6 @@ namespace osu.Game.Rulesets.Edit.Checks.Components /// An error occurred and a complete check could not be made. Error, - // TODO: Negligible issues should be hidden by default. /// A possible mistake so minor/unlikely that it can often be safely ignored. Negligible, } From 4aeaec6ecc610e4c043881451ff6495edea6bcbe Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Wed, 12 May 2021 01:32:18 +0200 Subject: [PATCH 09/28] Add `InterpretationSection` and its bindable in `IssueList` We'll eventually connect that bindable so that checks can access it. --- .../Edit/Verify/InterpretationSection.cs | 34 +++++++++++++++++++ osu.Game/Screens/Edit/Verify/IssueList.cs | 4 +++ osu.Game/Screens/Edit/Verify/IssueSettings.cs | 1 + 3 files changed, 39 insertions(+) create mode 100644 osu.Game/Screens/Edit/Verify/InterpretationSection.cs diff --git a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs new file mode 100644 index 0000000000..fa0bde9ddc --- /dev/null +++ b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs @@ -0,0 +1,34 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Overlays.Settings; + +namespace osu.Game.Screens.Edit.Verify +{ + internal class InterpretationSection : Section + { + public InterpretationSection(IssueList issueList) + : base(issueList) + { + } + + protected override string Header => "Interpretation"; + + [BackgroundDependencyLoader] + private void load() + { + var dropdown = new SettingsEnumDropdown + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TooltipText = "Affects checks that depend on difficulty level" + }; + dropdown.Current.BindTo(IssueList.InterpretedDifficulty); + + Flow.Add(dropdown); + } + } +} diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index b7a6d769e3..3e836c4010 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -36,6 +36,8 @@ namespace osu.Game.Screens.Edit.Verify public Dictionary> ShowType { get; set; } + public Bindable InterpretedDifficulty { get; set; } + private IBeatmapVerifier rulesetVerifier; private BeatmapVerifier generalVerifier; @@ -53,6 +55,8 @@ namespace osu.Game.Screens.Edit.Verify generalVerifier = new BeatmapVerifier(); rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier(); + InterpretedDifficulty = new Bindable(beatmap.BeatmapInfo.DifficultyRating); + RelativeSizeAxes = Axes.Both; InternalChildren = new Drawable[] diff --git a/osu.Game/Screens/Edit/Verify/IssueSettings.cs b/osu.Game/Screens/Edit/Verify/IssueSettings.cs index 0df3ab0dcb..68ab51c3c8 100644 --- a/osu.Game/Screens/Edit/Verify/IssueSettings.cs +++ b/osu.Game/Screens/Edit/Verify/IssueSettings.cs @@ -17,6 +17,7 @@ namespace osu.Game.Screens.Edit.Verify protected override IReadOnlyList CreateSections() => new Drawable[] { + new InterpretationSection(issueList), new VisibilitySection(issueList) }; } From 17e376457610652e9cfac1470eb8748114441022 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 May 2021 16:38:04 +0900 Subject: [PATCH 10/28] Rename `Settings` to have a more localised name --- .../Edit/{Settings.cs => RoundedContentEditorScreenSettings.cs} | 2 +- osu.Game/Screens/Edit/Timing/ControlPointSettings.cs | 2 +- osu.Game/Screens/Edit/Verify/IssueSettings.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename osu.Game/Screens/Edit/{Settings.cs => RoundedContentEditorScreenSettings.cs} (94%) diff --git a/osu.Game/Screens/Edit/Settings.cs b/osu.Game/Screens/Edit/RoundedContentEditorScreenSettings.cs similarity index 94% rename from osu.Game/Screens/Edit/Settings.cs rename to osu.Game/Screens/Edit/RoundedContentEditorScreenSettings.cs index 758414333d..06293fbaac 100644 --- a/osu.Game/Screens/Edit/Settings.cs +++ b/osu.Game/Screens/Edit/RoundedContentEditorScreenSettings.cs @@ -11,7 +11,7 @@ using osu.Game.Overlays; namespace osu.Game.Screens.Edit { - public abstract class Settings : CompositeDrawable + public abstract class RoundedContentEditorScreenSettings : CompositeDrawable { [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) diff --git a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs index 36f31d4be4..13f81c75da 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; namespace osu.Game.Screens.Edit.Timing { - public class ControlPointSettings : Settings + public class ControlPointSettings : RoundedContentEditorScreenSettings { protected override IReadOnlyList CreateSections() => new Drawable[] { diff --git a/osu.Game/Screens/Edit/Verify/IssueSettings.cs b/osu.Game/Screens/Edit/Verify/IssueSettings.cs index 68ab51c3c8..506694aa46 100644 --- a/osu.Game/Screens/Edit/Verify/IssueSettings.cs +++ b/osu.Game/Screens/Edit/Verify/IssueSettings.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; namespace osu.Game.Screens.Edit.Verify { - public class IssueSettings : Settings + public class IssueSettings : RoundedContentEditorScreenSettings { private readonly IssueList issueList; From d2e0e8ad948aac6ef137abf81d50963ba8e55297 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 May 2021 16:53:49 +0900 Subject: [PATCH 11/28] Reverse direction of binding to allow for better abstract class definitions --- ...tEditorScreen.cs => EditorRoundedScreen.cs} | 4 ++-- ...tings.cs => EditorRoundedScreenSettings.cs} | 2 +- ...s => EditorRoundedScreenSettingsSection.cs} | 11 ++--------- osu.Game/Screens/Edit/Setup/SetupScreen.cs | 2 +- .../Screens/Edit/Setup/SetupScreenHeader.cs | 2 +- osu.Game/Screens/Edit/Setup/SetupSection.cs | 2 +- .../Edit/Timing/ControlPointSettings.cs | 2 +- osu.Game/Screens/Edit/Timing/TimingScreen.cs | 2 +- .../Edit/Verify/InterpretationSection.cs | 11 +++++------ osu.Game/Screens/Edit/Verify/IssueList.cs | 5 +++-- osu.Game/Screens/Edit/Verify/IssueSettings.cs | 13 +++---------- osu.Game/Screens/Edit/Verify/IssueTable.cs | 5 ++++- osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 18 +++++++++++------- .../Screens/Edit/Verify/VisibilitySection.cs | 14 ++++++-------- 14 files changed, 42 insertions(+), 51 deletions(-) rename osu.Game/Screens/Edit/{RoundedContentEditorScreen.cs => EditorRoundedScreen.cs} (93%) rename osu.Game/Screens/Edit/{RoundedContentEditorScreenSettings.cs => EditorRoundedScreenSettings.cs} (94%) rename osu.Game/Screens/Edit/{Verify/Section.cs => EditorRoundedScreenSettingsSection.cs} (88%) diff --git a/osu.Game/Screens/Edit/RoundedContentEditorScreen.cs b/osu.Game/Screens/Edit/EditorRoundedScreen.cs similarity index 93% rename from osu.Game/Screens/Edit/RoundedContentEditorScreen.cs rename to osu.Game/Screens/Edit/EditorRoundedScreen.cs index a55ae3f635..c6ced02021 100644 --- a/osu.Game/Screens/Edit/RoundedContentEditorScreen.cs +++ b/osu.Game/Screens/Edit/EditorRoundedScreen.cs @@ -10,7 +10,7 @@ using osu.Game.Overlays; namespace osu.Game.Screens.Edit { - public class RoundedContentEditorScreen : EditorScreen + public class EditorRoundedScreen : EditorScreen { public const int HORIZONTAL_PADDING = 100; @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit protected override Container Content => roundedContent; - public RoundedContentEditorScreen(EditorScreenMode mode) + public EditorRoundedScreen(EditorScreenMode mode) : base(mode) { ColourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); diff --git a/osu.Game/Screens/Edit/RoundedContentEditorScreenSettings.cs b/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs similarity index 94% rename from osu.Game/Screens/Edit/RoundedContentEditorScreenSettings.cs rename to osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs index 06293fbaac..cb17484d27 100644 --- a/osu.Game/Screens/Edit/RoundedContentEditorScreenSettings.cs +++ b/osu.Game/Screens/Edit/EditorRoundedScreenSettings.cs @@ -11,7 +11,7 @@ using osu.Game.Overlays; namespace osu.Game.Screens.Edit { - public abstract class RoundedContentEditorScreenSettings : CompositeDrawable + public abstract class EditorRoundedScreenSettings : CompositeDrawable { [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) diff --git a/osu.Game/Screens/Edit/Verify/Section.cs b/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs similarity index 88% rename from osu.Game/Screens/Edit/Verify/Section.cs rename to osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs index f6815a05a1..87ed98a439 100644 --- a/osu.Game/Screens/Edit/Verify/Section.cs +++ b/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs @@ -9,22 +9,15 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osuTK; -namespace osu.Game.Screens.Edit.Verify +namespace osu.Game.Screens.Edit { - public abstract class Section : CompositeDrawable + public abstract class EditorRoundedScreenSettingsSection : CompositeDrawable { private const int header_height = 50; - protected readonly IssueList IssueList; - protected FillFlowContainer Flow; protected abstract string Header { get; } - protected Section(IssueList issueList) - { - IssueList = issueList; - } - [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { diff --git a/osu.Game/Screens/Edit/Setup/SetupScreen.cs b/osu.Game/Screens/Edit/Setup/SetupScreen.cs index 0af7cf095b..5bbec2574f 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreen.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreen.cs @@ -7,7 +7,7 @@ using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Edit.Setup { - public class SetupScreen : RoundedContentEditorScreen + public class SetupScreen : EditorRoundedScreen { [Cached] private SectionsContainer sections = new SectionsContainer(); diff --git a/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs b/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs index 10daacc359..2d0afda001 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreenHeader.cs @@ -93,7 +93,7 @@ namespace osu.Game.Screens.Edit.Setup public SetupScreenTabControl() { - TabContainer.Margin = new MarginPadding { Horizontal = RoundedContentEditorScreen.HORIZONTAL_PADDING }; + TabContainer.Margin = new MarginPadding { Horizontal = EditorRoundedScreen.HORIZONTAL_PADDING }; AddInternal(background = new Box { diff --git a/osu.Game/Screens/Edit/Setup/SetupSection.cs b/osu.Game/Screens/Edit/Setup/SetupSection.cs index b3ae15900f..8964e651df 100644 --- a/osu.Game/Screens/Edit/Setup/SetupSection.cs +++ b/osu.Game/Screens/Edit/Setup/SetupSection.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Edit.Setup Padding = new MarginPadding { Vertical = 10, - Horizontal = RoundedContentEditorScreen.HORIZONTAL_PADDING + Horizontal = EditorRoundedScreen.HORIZONTAL_PADDING }; InternalChild = new FillFlowContainer diff --git a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs index 13f81c75da..48639789af 100644 --- a/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs +++ b/osu.Game/Screens/Edit/Timing/ControlPointSettings.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; namespace osu.Game.Screens.Edit.Timing { - public class ControlPointSettings : RoundedContentEditorScreenSettings + public class ControlPointSettings : EditorRoundedScreenSettings { protected override IReadOnlyList CreateSections() => new Drawable[] { diff --git a/osu.Game/Screens/Edit/Timing/TimingScreen.cs b/osu.Game/Screens/Edit/Timing/TimingScreen.cs index 9f26dece08..a4193d5084 100644 --- a/osu.Game/Screens/Edit/Timing/TimingScreen.cs +++ b/osu.Game/Screens/Edit/Timing/TimingScreen.cs @@ -15,7 +15,7 @@ using osuTK; namespace osu.Game.Screens.Edit.Timing { - public class TimingScreen : RoundedContentEditorScreen + public class TimingScreen : EditorRoundedScreen { [Cached] private Bindable selectedGroup = new Bindable(); diff --git a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs index fa0bde9ddc..7991786542 100644 --- a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs +++ b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs @@ -8,12 +8,10 @@ using osu.Game.Overlays.Settings; namespace osu.Game.Screens.Edit.Verify { - internal class InterpretationSection : Section + internal class InterpretationSection : EditorRoundedScreenSettingsSection { - public InterpretationSection(IssueList issueList) - : base(issueList) - { - } + [Resolved] + private VerifyScreen verify { get; set; } protected override string Header => "Interpretation"; @@ -26,7 +24,8 @@ namespace osu.Game.Screens.Edit.Verify Origin = Anchor.CentreLeft, TooltipText = "Affects checks that depend on difficulty level" }; - dropdown.Current.BindTo(IssueList.InterpretedDifficulty); + + dropdown.Current.BindTo(verify.InterpretedDifficulty); Flow.Add(dropdown); } diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 3e836c4010..befffdd9db 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -18,6 +18,7 @@ using osuTK; namespace osu.Game.Screens.Edit.Verify { + [Cached] public class IssueList : CompositeDrawable { private IssueTable table; @@ -32,7 +33,7 @@ namespace osu.Game.Screens.Edit.Verify private EditorBeatmap beatmap { get; set; } [Resolved] - private Bindable selectedIssue { get; set; } + private VerifyScreen verify { get; set; } public Dictionary> ShowType { get; set; } @@ -55,7 +56,7 @@ namespace osu.Game.Screens.Edit.Verify generalVerifier = new BeatmapVerifier(); rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier(); - InterpretedDifficulty = new Bindable(beatmap.BeatmapInfo.DifficultyRating); + InterpretedDifficulty = verify.InterpretedDifficulty.GetBoundCopy(); RelativeSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Edit/Verify/IssueSettings.cs b/osu.Game/Screens/Edit/Verify/IssueSettings.cs index 506694aa46..ae3ef7e0b0 100644 --- a/osu.Game/Screens/Edit/Verify/IssueSettings.cs +++ b/osu.Game/Screens/Edit/Verify/IssueSettings.cs @@ -6,19 +6,12 @@ using osu.Framework.Graphics; namespace osu.Game.Screens.Edit.Verify { - public class IssueSettings : RoundedContentEditorScreenSettings + public class IssueSettings : EditorRoundedScreenSettings { - private readonly IssueList issueList; - - public IssueSettings(IssueList issueList) - { - this.issueList = issueList; - } - protected override IReadOnlyList CreateSections() => new Drawable[] { - new InterpretationSection(issueList), - new VisibilitySection(issueList) + new InterpretationSection(), + new VisibilitySection() }; } } diff --git a/osu.Game/Screens/Edit/Verify/IssueTable.cs b/osu.Game/Screens/Edit/Verify/IssueTable.cs index 44244028c9..05a8fdd26d 100644 --- a/osu.Game/Screens/Edit/Verify/IssueTable.cs +++ b/osu.Game/Screens/Edit/Verify/IssueTable.cs @@ -18,7 +18,9 @@ namespace osu.Game.Screens.Edit.Verify public class IssueTable : EditorTable { [Resolved] - private Bindable selectedIssue { get; set; } + private VerifyScreen verify { get; set; } + + private Bindable selectedIssue; [Resolved] private EditorClock clock { get; set; } @@ -71,6 +73,7 @@ namespace osu.Game.Screens.Edit.Verify { base.LoadComplete(); + selectedIssue = verify.SelectedIssue.GetBoundCopy(); selectedIssue.BindValueChanged(issue => { foreach (var b in BackgroundFlow) b.Selected = b.Item == issue.NewValue; diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index ed4658da8e..afd0c8760d 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -5,14 +5,19 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit.Checks.Components; namespace osu.Game.Screens.Edit.Verify { - public class VerifyScreen : RoundedContentEditorScreen + [Cached] + public class VerifyScreen : EditorRoundedScreen { - [Cached] - private Bindable selectedIssue = new Bindable(); + public readonly Bindable SelectedIssue = new Bindable(); + + public readonly Bindable InterpretedDifficulty = new Bindable(); + + public IssueList IssueList { get; private set; } public VerifyScreen() : base(EditorScreenMode.Verify) @@ -22,8 +27,7 @@ namespace osu.Game.Screens.Edit.Verify [BackgroundDependencyLoader] private void load() { - IssueList issueList; - + IssueList = new IssueList(); Child = new Container { RelativeSizeAxes = Axes.Both, @@ -39,8 +43,8 @@ namespace osu.Game.Screens.Edit.Verify { new Drawable[] { - issueList = new IssueList(), - new IssueSettings(issueList), + IssueList, + new IssueSettings(), }, } } diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index f849426800..ce755bdcb4 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -9,19 +9,17 @@ using osu.Game.Rulesets.Edit.Checks.Components; namespace osu.Game.Screens.Edit.Verify { - internal class VisibilitySection : Section + internal class VisibilitySection : EditorRoundedScreenSettingsSection { - public VisibilitySection(IssueList issueList) - : base(issueList) - { - } + [Resolved] + private VerifyScreen verify { get; set; } protected override string Header => "Visibility"; [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { - foreach (IssueType issueType in IssueList.ShowType.Keys) + foreach (IssueType issueType in verify.IssueList.ShowType.Keys) { var checkbox = new SettingsCheckbox { @@ -30,8 +28,8 @@ namespace osu.Game.Screens.Edit.Verify LabelText = issueType.ToString() }; - checkbox.Current.BindTo(IssueList.ShowType[issueType]); - checkbox.Current.BindValueChanged(_ => IssueList.Refresh()); + checkbox.Current.BindTo(verify.IssueList.ShowType[issueType]); + checkbox.Current.BindValueChanged(_ => verify.IssueList.Refresh()); Flow.Add(checkbox); } } From 80e231d90ad9a25444b7a2e2c1d43413cbaf327e Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 12 May 2021 11:07:31 +0300 Subject: [PATCH 12/28] Add failing test case --- .../Visual/Editing/TestSceneComposeSelectBox.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs index e383aa8008..d5cfeb1878 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs @@ -167,5 +167,21 @@ namespace osu.Game.Tests.Visual.Editing AddStep("move mouse away", () => InputManager.MoveMouseTo(selectionBox, new Vector2(20))); AddUntilStep("rotation handle hidden", () => rotationHandle.Alpha == 0); } + + /// + /// Tests that hovering over two handles instantaneously from one to another does not crash or cause issues to the visibility state. + /// + [Test] + public void TestHoverOverTwoHandlesInstantaneously() + { + AddStep("hover over top-left scale handle", () => + InputManager.MoveMouseTo(this.ChildrenOfType().Single(s => s.Anchor == Anchor.TopLeft))); + AddStep("hover over top-right scale handle", () => + InputManager.MoveMouseTo(this.ChildrenOfType().Single(s => s.Anchor == Anchor.TopRight))); + AddUntilStep("top-left rotation handle hidden", () => + this.ChildrenOfType().Single(r => r.Anchor == Anchor.TopLeft).Alpha == 0); + AddUntilStep("top-right rotation handle shown", () => + this.ChildrenOfType().Single(r => r.Anchor == Anchor.TopRight).Alpha == 1); + } } } From 96d3586294dbfef0f9af5b7a9e70e00a868d0600 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 12 May 2021 11:30:12 +0300 Subject: [PATCH 13/28] Fix rotation handle visibility logic not handling two handles hovered at once --- .../Compose/Components/SelectionBoxDragHandleContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs index 456f72878d..397158b9f6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandleContainer.cs @@ -84,8 +84,8 @@ namespace osu.Game.Screens.Edit.Compose.Components if (activeHandle?.IsHeld == true) return; - activeHandle = rotationHandles.SingleOrDefault(h => h.IsHeld || h.IsHovered); - activeHandle ??= allDragHandles.SingleOrDefault(h => h.IsHovered); + activeHandle = rotationHandles.FirstOrDefault(h => h.IsHeld || h.IsHovered); + activeHandle ??= allDragHandles.FirstOrDefault(h => h.IsHovered); if (activeHandle != null) { From 56bd8976666ee49318ab22d4dcfa86f5f7b627ae Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 04:29:27 +0200 Subject: [PATCH 14/28] Move `ShowIssueTypes` to `VerifyScreen` --- osu.Game/Screens/Edit/Verify/IssueList.cs | 14 ++------------ osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 8 ++++++++ osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index befffdd9db..f2d3ef9dda 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -35,8 +35,6 @@ namespace osu.Game.Screens.Edit.Verify [Resolved] private VerifyScreen verify { get; set; } - public Dictionary> ShowType { get; set; } - public Bindable InterpretedDifficulty { get; set; } private IBeatmapVerifier rulesetVerifier; @@ -45,14 +43,6 @@ namespace osu.Game.Screens.Edit.Verify [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { - // Reflects the user interface. Only types in this dictionary have configurable visibility. - ShowType = new Dictionary> - { - { IssueType.Warning, new Bindable(true) }, - { IssueType.Error, new Bindable(true) }, - { IssueType.Negligible, new Bindable(false) } - }; - generalVerifier = new BeatmapVerifier(); rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier(); @@ -116,9 +106,9 @@ namespace osu.Game.Screens.Edit.Verify private IEnumerable filter(IEnumerable issues) { - foreach (IssueType issueType in ShowType.Keys) + foreach (var issueType in verify.ShowIssueType.Keys) { - if (!ShowType[issueType].Value) + if (!verify.ShowIssueType[issueType].Value) issues = issues.Where(issue => issue.Template.Type != issueType); } diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index afd0c8760d..cf1a471714 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -17,6 +18,13 @@ namespace osu.Game.Screens.Edit.Verify public readonly Bindable InterpretedDifficulty = new Bindable(); + public readonly Dictionary> ShowIssueType = new Dictionary> + { + { IssueType.Warning, new Bindable(true) }, + { IssueType.Error, new Bindable(true) }, + { IssueType.Negligible, new Bindable(false) } + }; + public IssueList IssueList { get; private set; } public VerifyScreen() diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index ce755bdcb4..71f3740d86 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Edit.Verify [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { - foreach (IssueType issueType in verify.IssueList.ShowType.Keys) + foreach (IssueType issueType in verify.ShowIssueType.Keys) { var checkbox = new SettingsCheckbox { @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Edit.Verify LabelText = issueType.ToString() }; - checkbox.Current.BindTo(verify.IssueList.ShowType[issueType]); + checkbox.Current.BindTo(verify.ShowIssueType[issueType]); checkbox.Current.BindValueChanged(_ => verify.IssueList.Refresh()); Flow.Add(checkbox); } From 6806e40ad99b1bb6b561765d05858d11e6f5223a Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 04:30:40 +0200 Subject: [PATCH 15/28] Remove unnecessary local variable This now exists in `VerifyScreen`, which we can access from here. --- osu.Game/Screens/Edit/Verify/IssueList.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index f2d3ef9dda..19536401e9 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -35,8 +35,6 @@ namespace osu.Game.Screens.Edit.Verify [Resolved] private VerifyScreen verify { get; set; } - public Bindable InterpretedDifficulty { get; set; } - private IBeatmapVerifier rulesetVerifier; private BeatmapVerifier generalVerifier; @@ -46,8 +44,6 @@ namespace osu.Game.Screens.Edit.Verify generalVerifier = new BeatmapVerifier(); rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier(); - InterpretedDifficulty = verify.InterpretedDifficulty.GetBoundCopy(); - RelativeSizeAxes = Axes.Both; InternalChildren = new Drawable[] From dd8423c4c4350b5db811c8338d80235b2fc8a432 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 04:36:20 +0200 Subject: [PATCH 16/28] Set interpreted difficulty to correct default --- osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index cf1a471714..963b77baa1 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -35,6 +35,9 @@ namespace osu.Game.Screens.Edit.Verify [BackgroundDependencyLoader] private void load() { + InterpretedDifficulty.Default = EditorBeatmap.BeatmapInfo.DifficultyRating; + InterpretedDifficulty.SetDefault(); + IssueList = new IssueList(); Child = new Container { From fbb76ba5989d10690411561dbec0d74b4c0151d6 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 04:50:32 +0200 Subject: [PATCH 17/28] Split `ShowIssueTypes` dict into hidden and configurable lists This way `VerifyScreen` is decoupled from which options `VisibilitySection` provides. Bindings are a bit less neat, though. --- osu.Game/Screens/Edit/Verify/IssueList.cs | 8 +------ osu.Game/Screens/Edit/Verify/VerifyScreen.cs | 8 +------ .../Screens/Edit/Verify/VisibilitySection.cs | 23 ++++++++++++++++--- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 19536401e9..22d410592e 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -102,13 +102,7 @@ namespace osu.Game.Screens.Edit.Verify private IEnumerable filter(IEnumerable issues) { - foreach (var issueType in verify.ShowIssueType.Keys) - { - if (!verify.ShowIssueType[issueType].Value) - issues = issues.Where(issue => issue.Template.Type != issueType); - } - - return issues; + return issues.Where(issue => !verify.HiddenIssueTypes.Contains(issue.Template.Type)); } } } diff --git a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs index 963b77baa1..6d7a4a72e2 100644 --- a/osu.Game/Screens/Edit/Verify/VerifyScreen.cs +++ b/osu.Game/Screens/Edit/Verify/VerifyScreen.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -18,12 +17,7 @@ namespace osu.Game.Screens.Edit.Verify public readonly Bindable InterpretedDifficulty = new Bindable(); - public readonly Dictionary> ShowIssueType = new Dictionary> - { - { IssueType.Warning, new Bindable(true) }, - { IssueType.Error, new Bindable(true) }, - { IssueType.Negligible, new Bindable(false) } - }; + public readonly BindableList HiddenIssueTypes = new BindableList { IssueType.Negligible }; public IssueList IssueList { get; private set; } diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index 71f3740d86..3698f51f66 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -14,12 +14,19 @@ namespace osu.Game.Screens.Edit.Verify [Resolved] private VerifyScreen verify { get; set; } + private readonly IssueType[] configurableIssueTypes = + { + IssueType.Warning, + IssueType.Error, + IssueType.Negligible + }; + protected override string Header => "Visibility"; [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { - foreach (IssueType issueType in verify.ShowIssueType.Keys) + foreach (IssueType issueType in configurableIssueTypes) { var checkbox = new SettingsCheckbox { @@ -28,8 +35,18 @@ namespace osu.Game.Screens.Edit.Verify LabelText = issueType.ToString() }; - checkbox.Current.BindTo(verify.ShowIssueType[issueType]); - checkbox.Current.BindValueChanged(_ => verify.IssueList.Refresh()); + checkbox.Current.Default = !verify.HiddenIssueTypes.Contains(issueType); + checkbox.Current.SetDefault(); + checkbox.Current.BindValueChanged(state => + { + if (!state.NewValue) + verify.HiddenIssueTypes.Add(issueType); + else + verify.HiddenIssueTypes.Remove(issueType); + + verify.IssueList.Refresh(); + }); + Flow.Add(checkbox); } } From c8d21f2c3fe65f4c5add3e1429c907a370a61b6a Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 05:25:02 +0200 Subject: [PATCH 18/28] Isolate refreshing to `IssueList` --- osu.Game/Screens/Edit/Verify/IssueList.cs | 6 +++--- osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 22d410592e..7eba50498c 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Edit.Verify new TriangleButton { Text = "Refresh", - Action = Refresh, + Action = refresh, Size = new Vector2(120, 40), Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -83,10 +83,10 @@ namespace osu.Game.Screens.Edit.Verify { base.LoadComplete(); - Refresh(); + verify.HiddenIssueTypes.BindCollectionChanged((o, s) => refresh(), runOnceImmediately: true); } - public void Refresh() + private void refresh() { var issues = generalVerifier.Run(beatmap, workingBeatmap.Value); diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index 3698f51f66..7ec3ecee07 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -43,8 +43,6 @@ namespace osu.Game.Screens.Edit.Verify verify.HiddenIssueTypes.Add(issueType); else verify.HiddenIssueTypes.Remove(issueType); - - verify.IssueList.Refresh(); }); Flow.Add(checkbox); From e86834b74060d5fc7e2e9314142316b74ccf821b Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 05:25:20 +0200 Subject: [PATCH 19/28] Use local bound copy for `HiddenIssueTypes` --- osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index 7ec3ecee07..48bf0523b1 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -26,6 +26,8 @@ namespace osu.Game.Screens.Edit.Verify [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { + var hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy(); + foreach (IssueType issueType in configurableIssueTypes) { var checkbox = new SettingsCheckbox @@ -35,14 +37,14 @@ namespace osu.Game.Screens.Edit.Verify LabelText = issueType.ToString() }; - checkbox.Current.Default = !verify.HiddenIssueTypes.Contains(issueType); + checkbox.Current.Default = !hiddenIssueTypes.Contains(issueType); checkbox.Current.SetDefault(); checkbox.Current.BindValueChanged(state => { if (!state.NewValue) - verify.HiddenIssueTypes.Add(issueType); + hiddenIssueTypes.Add(issueType); else - verify.HiddenIssueTypes.Remove(issueType); + hiddenIssueTypes.Remove(issueType); }); Flow.Add(checkbox); From 04c1585eb24ef0fa07333bc354c7122dc728e8df Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 05:38:45 +0200 Subject: [PATCH 20/28] Use more consistent lambda discards --- osu.Game/Screens/Edit/Verify/IssueList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 7eba50498c..03cd22ad54 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -83,7 +83,7 @@ namespace osu.Game.Screens.Edit.Verify { base.LoadComplete(); - verify.HiddenIssueTypes.BindCollectionChanged((o, s) => refresh(), runOnceImmediately: true); + verify.HiddenIssueTypes.BindCollectionChanged((_, __) => refresh(), runOnceImmediately: true); } private void refresh() From e80d8f69220509dc78a9fbdedd9eef797c27c7f1 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 05:46:47 +0200 Subject: [PATCH 21/28] Keep track of local bound copy --- osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index 48bf0523b1..cb7deb8566 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Overlays; using osu.Game.Overlays.Settings; @@ -21,12 +22,14 @@ namespace osu.Game.Screens.Edit.Verify IssueType.Negligible }; + private BindableList hiddenIssueTypes; + protected override string Header => "Visibility"; [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) { - var hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy(); + hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy(); foreach (IssueType issueType in configurableIssueTypes) { From ee0a6ba93e25df5425480f0427826b182055f6c4 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 05:59:49 +0200 Subject: [PATCH 22/28] Use local bound copy in `InterpretationSection` as well Else we're relying on the `VerifyScreen`'s bindable instance, and by extension the `VerifyScreen` instance itself. --- osu.Game/Screens/Edit/Verify/InterpretationSection.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs index 7991786542..1bdb528473 100644 --- a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs +++ b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Overlays.Settings; @@ -15,9 +16,13 @@ namespace osu.Game.Screens.Edit.Verify protected override string Header => "Interpretation"; + private Bindable interpretedDifficulty; + [BackgroundDependencyLoader] private void load() { + interpretedDifficulty = verify.InterpretedDifficulty.GetBoundCopy(); + var dropdown = new SettingsEnumDropdown { Anchor = Anchor.CentreLeft, @@ -25,7 +30,7 @@ namespace osu.Game.Screens.Edit.Verify TooltipText = "Affects checks that depend on difficulty level" }; - dropdown.Current.BindTo(verify.InterpretedDifficulty); + dropdown.Current.BindTo(interpretedDifficulty); Flow.Add(dropdown); } From fb305130deb9ba12229f36bb436635a04ac646d5 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 06:00:21 +0200 Subject: [PATCH 23/28] Also refresh when interpreted difficulty changes --- osu.Game/Screens/Edit/Verify/IssueList.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs index 03cd22ad54..407c1e3bc7 100644 --- a/osu.Game/Screens/Edit/Verify/IssueList.cs +++ b/osu.Game/Screens/Edit/Verify/IssueList.cs @@ -83,7 +83,10 @@ namespace osu.Game.Screens.Edit.Verify { base.LoadComplete(); - verify.HiddenIssueTypes.BindCollectionChanged((_, __) => refresh(), runOnceImmediately: true); + verify.InterpretedDifficulty.BindValueChanged(_ => refresh()); + verify.HiddenIssueTypes.BindCollectionChanged((_, __) => refresh()); + + refresh(); } private void refresh() From 47948d7b34c860e17d73579ac4ee6e91d69e3506 Mon Sep 17 00:00:00 2001 From: Naxess <30292137+Naxesss@users.noreply.github.com> Date: Thu, 13 May 2021 06:08:48 +0200 Subject: [PATCH 24/28] Set default for bindable in object initializer Fixes the CI failure. --- osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index cb7deb8566..f942621d2a 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -37,10 +37,10 @@ namespace osu.Game.Screens.Edit.Verify { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - LabelText = issueType.ToString() + LabelText = issueType.ToString(), + Current = { Default = !hiddenIssueTypes.Contains(issueType) } }; - checkbox.Current.Default = !hiddenIssueTypes.Contains(issueType); checkbox.Current.SetDefault(); checkbox.Current.BindValueChanged(state => { From cdcbaf4291e4bbf20b552a305244be92336dbe80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 May 2021 13:45:10 +0900 Subject: [PATCH 25/28] Tidy up specification of `SettingsSection` --- .../Screens/Edit/EditorRoundedScreenSettingsSection.cs | 7 ++++--- osu.Game/Screens/Edit/Verify/InterpretationSection.cs | 2 +- osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs b/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs index 87ed98a439..e17114ebcb 100644 --- a/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs +++ b/osu.Game/Screens/Edit/EditorRoundedScreenSettingsSection.cs @@ -15,8 +15,9 @@ namespace osu.Game.Screens.Edit { private const int header_height = 50; - protected FillFlowContainer Flow; - protected abstract string Header { get; } + protected abstract string HeaderText { get; } + + protected FillFlowContainer Flow { get; private set; } [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) @@ -36,7 +37,7 @@ namespace osu.Game.Screens.Edit { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Text = Header, + Text = HeaderText, Font = new FontUsage(size: 25, weight: "bold") } }, diff --git a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs index 1bdb528473..4dca94aacf 100644 --- a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs +++ b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs @@ -14,7 +14,7 @@ namespace osu.Game.Screens.Edit.Verify [Resolved] private VerifyScreen verify { get; set; } - protected override string Header => "Interpretation"; + protected override string HeaderText => "Interpretation"; private Bindable interpretedDifficulty; diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index f942621d2a..7ebfe586a7 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit.Verify private BindableList hiddenIssueTypes; - protected override string Header => "Visibility"; + protected override string HeaderText => "Visibility"; [BackgroundDependencyLoader] private void load(OverlayColourProvider colours) From c6648112e59f8a5c3429af35f72b99d8ceceb2c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 May 2021 13:51:41 +0900 Subject: [PATCH 26/28] Simplify binding flow in `InterpretationSection` --- .../Screens/Edit/Verify/InterpretationSection.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs index 4dca94aacf..7de87737f5 100644 --- a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs +++ b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Overlays.Settings; @@ -16,23 +15,16 @@ namespace osu.Game.Screens.Edit.Verify protected override string HeaderText => "Interpretation"; - private Bindable interpretedDifficulty; - [BackgroundDependencyLoader] private void load() { - interpretedDifficulty = verify.InterpretedDifficulty.GetBoundCopy(); - - var dropdown = new SettingsEnumDropdown + Flow.Add(new SettingsEnumDropdown { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - TooltipText = "Affects checks that depend on difficulty level" - }; - - dropdown.Current.BindTo(interpretedDifficulty); - - Flow.Add(dropdown); + TooltipText = "Affects checks that depend on difficulty level", + Current = verify.InterpretedDifficulty.GetBoundCopy() + }); } } } From b81f86bd4d9c088dce4a7c49fb16b768ccc3e669 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 May 2021 13:53:27 +0900 Subject: [PATCH 27/28] Move DI resolution to inside BDL parameters --- osu.Game/Screens/Edit/Verify/InterpretationSection.cs | 5 +---- osu.Game/Screens/Edit/Verify/VisibilitySection.cs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs index 7de87737f5..9548f8aaa9 100644 --- a/osu.Game/Screens/Edit/Verify/InterpretationSection.cs +++ b/osu.Game/Screens/Edit/Verify/InterpretationSection.cs @@ -10,13 +10,10 @@ namespace osu.Game.Screens.Edit.Verify { internal class InterpretationSection : EditorRoundedScreenSettingsSection { - [Resolved] - private VerifyScreen verify { get; set; } - protected override string HeaderText => "Interpretation"; [BackgroundDependencyLoader] - private void load() + private void load(VerifyScreen verify) { Flow.Add(new SettingsEnumDropdown { diff --git a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs index 7ebfe586a7..d049436376 100644 --- a/osu.Game/Screens/Edit/Verify/VisibilitySection.cs +++ b/osu.Game/Screens/Edit/Verify/VisibilitySection.cs @@ -12,9 +12,6 @@ namespace osu.Game.Screens.Edit.Verify { internal class VisibilitySection : EditorRoundedScreenSettingsSection { - [Resolved] - private VerifyScreen verify { get; set; } - private readonly IssueType[] configurableIssueTypes = { IssueType.Warning, @@ -27,7 +24,7 @@ namespace osu.Game.Screens.Edit.Verify protected override string HeaderText => "Visibility"; [BackgroundDependencyLoader] - private void load(OverlayColourProvider colours) + private void load(OverlayColourProvider colours, VerifyScreen verify) { hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy(); From e5f765d1a8ef42e9a12fe94dbe23f3d464d1972d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 May 2021 19:06:58 +0900 Subject: [PATCH 28/28] Fix broken exception message --- osu.Game/Skinning/Editor/SkinEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 67285987ef..cb27a84a75 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -166,7 +166,7 @@ namespace osu.Game.Skinning.Editor private void placeComponent(Type type) { if (!(Activator.CreateInstance(type) is ISkinnableDrawable component)) - throw new InvalidOperationException("Attempted to instantiate a component for placement which was not an {typeof(ISkinnableComponent)}."); + throw new InvalidOperationException($"Attempted to instantiate a component for placement which was not an {typeof(ISkinnableDrawable)}."); getTarget(SkinnableTarget.MainHUDComponents)?.Add(component);