2021-03-28 15:36:22 +00: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 System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Allocation;
|
2021-04-10 11:04:39 +00:00
|
|
|
using osu.Framework.Bindables;
|
2021-03-28 15:36:22 +00:00
|
|
|
using osu.Framework.Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-09-16 09:28:35 +00:00
|
|
|
using osu.Framework.Input.Events;
|
2021-03-28 15:36:22 +00:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-04-07 12:38:43 +00:00
|
|
|
using osu.Game.Input.Bindings;
|
2021-04-10 11:02:22 +00:00
|
|
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
2021-03-28 15:36:22 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Verify
|
|
|
|
{
|
2021-04-13 14:05:58 +00:00
|
|
|
public partial class IssueTable : EditorTable
|
2021-03-28 15:36:22 +00:00
|
|
|
{
|
2022-11-27 02:45:56 +00:00
|
|
|
private Bindable<Issue> selectedIssue = null!;
|
2021-05-12 07:53:49 +00:00
|
|
|
|
2022-11-27 02:45:56 +00:00
|
|
|
[Resolved]
|
|
|
|
private VerifyScreen verify { get; set; } = null!;
|
2021-04-10 11:04:39 +00:00
|
|
|
|
2021-04-13 14:26:19 +00:00
|
|
|
[Resolved]
|
2022-11-27 02:45:56 +00:00
|
|
|
private EditorClock clock { get; set; } = null!;
|
2021-04-13 14:26:19 +00:00
|
|
|
|
|
|
|
[Resolved]
|
2022-11-27 02:45:56 +00:00
|
|
|
private EditorBeatmap editorBeatmap { get; set; } = null!;
|
2021-04-13 14:26:19 +00:00
|
|
|
|
|
|
|
[Resolved]
|
2022-11-27 02:45:56 +00:00
|
|
|
private Editor editor { get; set; } = null!;
|
2021-04-13 14:26:19 +00:00
|
|
|
|
2021-03-28 15:36:22 +00:00
|
|
|
public IEnumerable<Issue> Issues
|
|
|
|
{
|
|
|
|
set
|
|
|
|
{
|
|
|
|
Content = null;
|
2021-04-13 14:05:58 +00:00
|
|
|
BackgroundFlow.Clear();
|
2021-03-28 15:36:22 +00:00
|
|
|
|
2022-11-27 03:23:08 +00:00
|
|
|
if (!value.Any())
|
2021-03-28 15:36:22 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
foreach (var issue in value)
|
|
|
|
{
|
2021-04-13 14:26:19 +00:00
|
|
|
BackgroundFlow.Add(new RowBackground(issue)
|
|
|
|
{
|
|
|
|
Action = () =>
|
|
|
|
{
|
|
|
|
selectedIssue.Value = issue;
|
|
|
|
|
|
|
|
if (issue.Time != null)
|
|
|
|
{
|
|
|
|
clock.Seek(issue.Time.Value);
|
2021-09-16 09:28:35 +00:00
|
|
|
editor.OnPressed(new KeyBindingPressEvent<GlobalAction>(GetContainingInputManager().CurrentState, GlobalAction.EditorComposeMode));
|
2021-04-13 14:26:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!issue.HitObjects.Any())
|
|
|
|
return;
|
|
|
|
|
|
|
|
editorBeatmap.SelectedHitObjects.Clear();
|
|
|
|
editorBeatmap.SelectedHitObjects.AddRange(issue.HitObjects);
|
|
|
|
},
|
|
|
|
});
|
2021-03-28 15:36:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Columns = createHeaders();
|
|
|
|
Content = value.Select((g, i) => createContent(i, g)).ToArray().ToRectangular();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-13 14:26:19 +00:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2021-05-12 07:53:49 +00:00
|
|
|
selectedIssue = verify.SelectedIssue.GetBoundCopy();
|
2021-04-13 14:26:19 +00:00
|
|
|
selectedIssue.BindValueChanged(issue =>
|
|
|
|
{
|
2022-11-30 05:17:49 +00:00
|
|
|
SetSelectedRow(issue.NewValue);
|
2021-04-13 14:26:19 +00:00
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
|
2021-03-28 15:36:22 +00:00
|
|
|
private TableColumn[] createHeaders()
|
|
|
|
{
|
|
|
|
var columns = new List<TableColumn>
|
|
|
|
{
|
2021-04-10 11:10:05 +00:00
|
|
|
new TableColumn(string.Empty, Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)),
|
2022-11-29 18:22:07 +00:00
|
|
|
new TableColumn("Type", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize, minSize: 60)),
|
|
|
|
new TableColumn("Time", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize, minSize: 60)),
|
|
|
|
new TableColumn("Message", Anchor.CentreLeft),
|
|
|
|
new TableColumn("Category", Anchor.CentreRight, new Dimension(GridSizeMode.AutoSize)),
|
2021-03-28 15:36:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return columns.ToArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
private Drawable[] createContent(int index, Issue issue) => new Drawable[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = $"#{index + 1}",
|
2021-04-13 14:05:58 +00:00
|
|
|
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Medium),
|
2021-04-10 11:10:05 +00:00
|
|
|
Margin = new MarginPadding { Right = 10 }
|
2021-04-07 12:38:43 +00:00
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = issue.Template.Type.ToString(),
|
2021-04-13 14:05:58 +00:00
|
|
|
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
|
2021-04-10 11:10:05 +00:00
|
|
|
Margin = new MarginPadding { Right = 10 },
|
2021-04-12 06:30:33 +00:00
|
|
|
Colour = issue.Template.Colour
|
2021-04-07 12:38:43 +00:00
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = issue.GetEditorTimestamp(),
|
2021-04-13 14:05:58 +00:00
|
|
|
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
|
2021-04-10 11:10:05 +00:00
|
|
|
Margin = new MarginPadding { Right = 10 },
|
2021-03-28 15:36:22 +00:00
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
2021-04-07 12:38:43 +00:00
|
|
|
Text = issue.ToString(),
|
2021-04-13 14:05:58 +00:00
|
|
|
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Medium)
|
2021-03-28 15:36:22 +00:00
|
|
|
},
|
2021-04-07 12:38:43 +00:00
|
|
|
new OsuSpriteText
|
|
|
|
{
|
2021-04-12 13:47:58 +00:00
|
|
|
Text = issue.Check.Metadata.Category.ToString(),
|
2021-04-13 14:05:58 +00:00
|
|
|
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
|
2021-04-07 12:38:43 +00:00
|
|
|
Margin = new MarginPadding(10)
|
|
|
|
}
|
2021-03-28 15:36:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|