1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Apply NRT to BeatmapPicker

This commit is contained in:
Joseph Madamba 2023-01-15 14:15:36 -08:00
parent 85c1932851
commit b733f46c6f
2 changed files with 11 additions and 15 deletions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -50,7 +48,7 @@ namespace osu.Game.Tests.Visual.Navigation
public void TestBeatmapLink() public void TestBeatmapLink()
{ {
AddUntilStep("Beatmap overlay displayed", () => Game.ChildrenOfType<BeatmapSetOverlay>().FirstOrDefault()?.State.Value == Visibility.Visible); AddUntilStep("Beatmap overlay displayed", () => Game.ChildrenOfType<BeatmapSetOverlay>().FirstOrDefault()?.State.Value == Visibility.Visible);
AddUntilStep("Beatmap overlay showing content", () => Game.ChildrenOfType<BeatmapPicker>().FirstOrDefault()?.Beatmap.Value.OnlineID == requested_beatmap_id); AddUntilStep("Beatmap overlay showing content", () => Game.ChildrenOfType<BeatmapPicker>().FirstOrDefault()?.Beatmap.Value?.OnlineID == requested_beatmap_id);
} }
} }
} }

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework; using osu.Framework;
@ -38,10 +36,10 @@ namespace osu.Game.Overlays.BeatmapSet
public readonly DifficultiesContainer Difficulties; public readonly DifficultiesContainer Difficulties;
public readonly Bindable<APIBeatmap> Beatmap = new Bindable<APIBeatmap>(); public readonly Bindable<APIBeatmap?> Beatmap = new Bindable<APIBeatmap?>();
private APIBeatmapSet beatmapSet; private APIBeatmapSet? beatmapSet;
public APIBeatmapSet BeatmapSet public APIBeatmapSet? BeatmapSet
{ {
get => beatmapSet; get => beatmapSet;
set set
@ -142,7 +140,7 @@ namespace osu.Game.Overlays.BeatmapSet
} }
[Resolved] [Resolved]
private IBindable<RulesetInfo> ruleset { get; set; } private IBindable<RulesetInfo> ruleset { get; set; } = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
@ -200,9 +198,9 @@ namespace osu.Game.Overlays.BeatmapSet
updateDifficultyButtons(); updateDifficultyButtons();
} }
private void showBeatmap(IBeatmapInfo beatmapInfo) private void showBeatmap(IBeatmapInfo? beatmapInfo)
{ {
version.Text = beatmapInfo?.DifficultyName; version.Text = beatmapInfo?.DifficultyName ?? string.Empty;
} }
private void updateDifficultyButtons() private void updateDifficultyButtons()
@ -212,7 +210,7 @@ namespace osu.Game.Overlays.BeatmapSet
public partial class DifficultiesContainer : FillFlowContainer<DifficultySelectorButton> public partial class DifficultiesContainer : FillFlowContainer<DifficultySelectorButton>
{ {
public Action OnLostHover; public Action? OnLostHover;
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
@ -233,9 +231,9 @@ namespace osu.Game.Overlays.BeatmapSet
public readonly APIBeatmap Beatmap; public readonly APIBeatmap Beatmap;
public Action<APIBeatmap> OnHovered; public Action<APIBeatmap>? OnHovered;
public Action<APIBeatmap> OnClicked; public Action<APIBeatmap>? OnClicked;
public event Action<DifficultySelectorState> StateChanged; public event Action<DifficultySelectorState>? StateChanged;
private DifficultySelectorState state; private DifficultySelectorState state;