1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Add issue selection

This mainly helps with keeping track of which issue was clicked, since doing so switches tab.
This commit is contained in:
Naxess 2021-04-10 13:04:39 +02:00
parent bc4f3351f3
commit 6d3cf78e4a
2 changed files with 45 additions and 4 deletions

View File

@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -26,6 +27,9 @@ namespace osu.Game.Screens.Edit.Verify
private readonly FillFlowContainer backgroundFlow;
[Resolved]
private Bindable<Issue> selectedIssue { get; set; }
public IssueTable()
{
RelativeSizeAxes = Axes.X;
@ -115,6 +119,7 @@ namespace osu.Game.Screens.Edit.Verify
public class RowBackground : OsuClickableContainer
{
private readonly Issue issue;
private const int fade_duration = 100;
private readonly Box hoveredBackground;
@ -128,13 +133,16 @@ namespace osu.Game.Screens.Edit.Verify
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
[Resolved]
private Bindable<Issue> selectedIssue { get; set; }
public RowBackground(Issue issue)
{
this.issue = issue;
RelativeSizeAxes = Axes.X;
Height = row_height;
AlwaysPresent = true;
CornerRadius = 3;
Masking = true;
@ -152,6 +160,8 @@ namespace osu.Game.Screens.Edit.Verify
// Supposed to work like clicking timestamps outside of the game.
// TODO: Is there already defined behaviour for this I may be able to call?
selectedIssue.Value = issue;
if (issue.Time != null)
{
clock.Seek(issue.Time.Value);
@ -167,11 +177,35 @@ namespace osu.Game.Screens.Edit.Verify
}
private Color4 colourHover;
private Color4 colourSelected;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
hoveredBackground.Colour = colourHover = colours.BlueDarker;
colourSelected = colours.YellowDarker;
}
protected override void LoadComplete()
{
base.LoadComplete();
selectedIssue.BindValueChanged(change => { Selected = issue == change.NewValue; }, true);
}
private bool selected;
protected bool Selected
{
get => selected;
set
{
if (value == selected)
return;
selected = value;
updateState();
}
}
protected override bool OnHover(HoverEvent e)
@ -188,9 +222,9 @@ namespace osu.Game.Screens.Edit.Verify
private void updateState()
{
hoveredBackground.FadeColour(colourHover, 450, Easing.OutQuint);
hoveredBackground.FadeColour(selected ? colourSelected : colourHover, 450, Easing.OutQuint);
if (IsHovered)
if (selected || IsHovered)
hoveredBackground.FadeIn(fade_duration, Easing.OutQuint);
else
hoveredBackground.FadeOut(fade_duration, Easing.OutQuint);

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
using osuTK;
namespace osu.Game.Screens.Edit.Verify
@ -22,6 +23,9 @@ namespace osu.Game.Screens.Edit.Verify
private Ruleset ruleset;
private static Checker checker; // TODO: Should not be static, but apparently needs to be?
[Cached]
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
public VerifyScreen()
: base(EditorScreenMode.Verify)
{
@ -74,6 +78,9 @@ namespace osu.Game.Screens.Edit.Verify
[Resolved]
protected EditorBeatmap Beatmap { get; private set; }
[Resolved]
private Bindable<Issue> selectedIssue { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{