mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 03:02:59 +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:
parent
bc4f3351f3
commit
6d3cf78e4a
@ -4,6 +4,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -26,6 +27,9 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
|
|
||||||
private readonly FillFlowContainer backgroundFlow;
|
private readonly FillFlowContainer backgroundFlow;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<Issue> selectedIssue { get; set; }
|
||||||
|
|
||||||
public IssueTable()
|
public IssueTable()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -115,6 +119,7 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
|
|
||||||
public class RowBackground : OsuClickableContainer
|
public class RowBackground : OsuClickableContainer
|
||||||
{
|
{
|
||||||
|
private readonly Issue issue;
|
||||||
private const int fade_duration = 100;
|
private const int fade_duration = 100;
|
||||||
|
|
||||||
private readonly Box hoveredBackground;
|
private readonly Box hoveredBackground;
|
||||||
@ -128,13 +133,16 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap editorBeatmap { get; set; }
|
private EditorBeatmap editorBeatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<Issue> selectedIssue { get; set; }
|
||||||
|
|
||||||
public RowBackground(Issue issue)
|
public RowBackground(Issue issue)
|
||||||
{
|
{
|
||||||
|
this.issue = issue;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = row_height;
|
Height = row_height;
|
||||||
|
|
||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
|
|
||||||
CornerRadius = 3;
|
CornerRadius = 3;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
@ -152,6 +160,8 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
// Supposed to work like clicking timestamps outside of the game.
|
// Supposed to work like clicking timestamps outside of the game.
|
||||||
// TODO: Is there already defined behaviour for this I may be able to call?
|
// TODO: Is there already defined behaviour for this I may be able to call?
|
||||||
|
|
||||||
|
selectedIssue.Value = issue;
|
||||||
|
|
||||||
if (issue.Time != null)
|
if (issue.Time != null)
|
||||||
{
|
{
|
||||||
clock.Seek(issue.Time.Value);
|
clock.Seek(issue.Time.Value);
|
||||||
@ -167,11 +177,35 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Color4 colourHover;
|
private Color4 colourHover;
|
||||||
|
private Color4 colourSelected;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
hoveredBackground.Colour = colourHover = colours.BlueDarker;
|
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)
|
protected override bool OnHover(HoverEvent e)
|
||||||
@ -188,9 +222,9 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
|
|
||||||
private void updateState()
|
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);
|
hoveredBackground.FadeIn(fade_duration, Easing.OutQuint);
|
||||||
else
|
else
|
||||||
hoveredBackground.FadeOut(fade_duration, Easing.OutQuint);
|
hoveredBackground.FadeOut(fade_duration, Easing.OutQuint);
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Verify
|
namespace osu.Game.Screens.Edit.Verify
|
||||||
@ -22,6 +23,9 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
private Ruleset ruleset;
|
private Ruleset ruleset;
|
||||||
private static Checker checker; // TODO: Should not be static, but apparently needs to be?
|
private static Checker checker; // TODO: Should not be static, but apparently needs to be?
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private Bindable<Issue> selectedIssue = new Bindable<Issue>();
|
||||||
|
|
||||||
public VerifyScreen()
|
public VerifyScreen()
|
||||||
: base(EditorScreenMode.Verify)
|
: base(EditorScreenMode.Verify)
|
||||||
{
|
{
|
||||||
@ -74,6 +78,9 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
protected EditorBeatmap Beatmap { get; private set; }
|
protected EditorBeatmap Beatmap { get; private set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<Issue> selectedIssue { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user