mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into beatmap-verifier-context
This commit is contained in:
@ -8,27 +8,20 @@ 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)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string Header => "Interpretation";
|
||||
protected override string HeaderText => "Interpretation";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(VerifyScreen verify)
|
||||
{
|
||||
var dropdown = new SettingsEnumDropdown<DifficultyRating>
|
||||
Flow.Add(new SettingsEnumDropdown<DifficultyRating>
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TooltipText = "Affects checks that depend on difficulty level"
|
||||
};
|
||||
dropdown.Current.BindTo(IssueList.InterpretedDifficulty);
|
||||
|
||||
Flow.Add(dropdown);
|
||||
TooltipText = "Affects checks that depend on difficulty level",
|
||||
Current = verify.InterpretedDifficulty.GetBoundCopy()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Verify
|
||||
{
|
||||
[Cached]
|
||||
public class IssueList : CompositeDrawable
|
||||
{
|
||||
private IssueTable table;
|
||||
@ -32,11 +33,7 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
private EditorBeatmap beatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Bindable<Issue> selectedIssue { get; set; }
|
||||
|
||||
public Dictionary<IssueType, Bindable<bool>> ShowType { get; set; }
|
||||
|
||||
public Bindable<DifficultyRating> InterpretedDifficulty { get; set; }
|
||||
private VerifyScreen verify { get; set; }
|
||||
|
||||
private IBeatmapVerifier rulesetVerifier;
|
||||
private BeatmapVerifier generalVerifier;
|
||||
@ -45,21 +42,11 @@ 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, Bindable<bool>>
|
||||
{
|
||||
{ IssueType.Warning, new Bindable<bool>(true) },
|
||||
{ IssueType.Error, new Bindable<bool>(true) },
|
||||
{ IssueType.Negligible, new Bindable<bool>(false) }
|
||||
};
|
||||
|
||||
generalVerifier = new BeatmapVerifier();
|
||||
rulesetVerifier = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateBeatmapVerifier();
|
||||
|
||||
InterpretedDifficulty = new Bindable<DifficultyRating>(beatmap.BeatmapInfo.DifficultyRating);
|
||||
|
||||
context = new BeatmapVerifierContext(workingBeatmap.Value);
|
||||
context.InterpretedDifficulty.BindTo(InterpretedDifficulty);
|
||||
context.InterpretedDifficulty.BindTo(verify.InterpretedDifficulty.GetBoundCopy());
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -86,7 +73,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,
|
||||
@ -100,10 +87,13 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Refresh();
|
||||
verify.InterpretedDifficulty.BindValueChanged(_ => refresh());
|
||||
verify.HiddenIssueTypes.BindCollectionChanged((_, __) => refresh());
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
private void refresh()
|
||||
{
|
||||
var issues = generalVerifier.Run(beatmap, context);
|
||||
|
||||
@ -119,13 +109,7 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
|
||||
private IEnumerable<Issue> filter(IEnumerable<Issue> issues)
|
||||
{
|
||||
foreach (IssueType issueType in ShowType.Keys)
|
||||
{
|
||||
if (!ShowType[issueType].Value)
|
||||
issues = issues.Where(issue => issue.Template.Type != issueType);
|
||||
}
|
||||
|
||||
return issues;
|
||||
return issues.Where(issue => !verify.HiddenIssueTypes.Contains(issue.Template.Type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,19 +6,12 @@ using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Verify
|
||||
{
|
||||
public class IssueSettings : Settings
|
||||
public class IssueSettings : EditorRoundedScreenSettings
|
||||
{
|
||||
private readonly IssueList issueList;
|
||||
|
||||
public IssueSettings(IssueList issueList)
|
||||
{
|
||||
this.issueList = issueList;
|
||||
}
|
||||
|
||||
protected override IReadOnlyList<Drawable> CreateSections() => new Drawable[]
|
||||
{
|
||||
new InterpretationSection(issueList),
|
||||
new VisibilitySection(issueList)
|
||||
new InterpretationSection(),
|
||||
new VisibilitySection()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
public class IssueTable : EditorTable
|
||||
{
|
||||
[Resolved]
|
||||
private Bindable<Issue> selectedIssue { get; set; }
|
||||
private VerifyScreen verify { get; set; }
|
||||
|
||||
private Bindable<Issue> 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;
|
||||
|
@ -1,67 +0,0 @@
|
||||
// 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;
|
||||
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,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -5,14 +5,21 @@ 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<Issue> selectedIssue = new Bindable<Issue>();
|
||||
public readonly Bindable<Issue> SelectedIssue = new Bindable<Issue>();
|
||||
|
||||
public readonly Bindable<DifficultyRating> InterpretedDifficulty = new Bindable<DifficultyRating>();
|
||||
|
||||
public readonly BindableList<IssueType> HiddenIssueTypes = new BindableList<IssueType> { IssueType.Negligible };
|
||||
|
||||
public IssueList IssueList { get; private set; }
|
||||
|
||||
public VerifyScreen()
|
||||
: base(EditorScreenMode.Verify)
|
||||
@ -22,8 +29,10 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
IssueList issueList;
|
||||
InterpretedDifficulty.Default = EditorBeatmap.BeatmapInfo.DifficultyRating;
|
||||
InterpretedDifficulty.SetDefault();
|
||||
|
||||
IssueList = new IssueList();
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -39,8 +48,8 @@ namespace osu.Game.Screens.Edit.Verify
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
issueList = new IssueList(),
|
||||
new IssueSettings(issueList),
|
||||
IssueList,
|
||||
new IssueSettings(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -9,29 +10,43 @@ 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)
|
||||
private readonly IssueType[] configurableIssueTypes =
|
||||
{
|
||||
}
|
||||
IssueType.Warning,
|
||||
IssueType.Error,
|
||||
IssueType.Negligible
|
||||
};
|
||||
|
||||
protected override string Header => "Visibility";
|
||||
private BindableList<IssueType> hiddenIssueTypes;
|
||||
|
||||
protected override string HeaderText => "Visibility";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colours)
|
||||
private void load(OverlayColourProvider colours, VerifyScreen verify)
|
||||
{
|
||||
foreach (IssueType issueType in IssueList.ShowType.Keys)
|
||||
hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();
|
||||
|
||||
foreach (IssueType issueType in configurableIssueTypes)
|
||||
{
|
||||
var checkbox = new SettingsCheckbox
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
LabelText = issueType.ToString()
|
||||
LabelText = issueType.ToString(),
|
||||
Current = { Default = !hiddenIssueTypes.Contains(issueType) }
|
||||
};
|
||||
|
||||
checkbox.Current.BindTo(IssueList.ShowType[issueType]);
|
||||
checkbox.Current.BindValueChanged(_ => IssueList.Refresh());
|
||||
checkbox.Current.SetDefault();
|
||||
checkbox.Current.BindValueChanged(state =>
|
||||
{
|
||||
if (!state.NewValue)
|
||||
hiddenIssueTypes.Add(issueType);
|
||||
else
|
||||
hiddenIssueTypes.Remove(issueType);
|
||||
});
|
||||
|
||||
Flow.Add(checkbox);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user