Cache selected item bindable from RoomSubScreen

This commit is contained in:
smoogipoo 2021-02-16 17:35:44 +09:00
parent f25b5147ef
commit 855d24dce7
2 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
[Cached(typeof(IPreviewTrackOwner))]
public abstract class RoomSubScreen : OnlinePlaySubScreen, IPreviewTrackOwner
{
[Cached(typeof(IBindable<PlaylistItem>))]
protected readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
public override bool DisallowExternalBeatmapRulesetChanges => true;

View File

@ -2,10 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Match;
using osu.Game.Users;
namespace osu.Game.Screens.OnlinePlay
@ -50,5 +52,13 @@ namespace osu.Game.Screens.OnlinePlay
[Resolved(typeof(Room))]
protected Bindable<TimeSpan?> Duration { get; private set; }
/// <summary>
/// The currently selected item in the <see cref="RoomSubScreen"/>.
/// May be null if this <see cref="OnlinePlayComposite"/> is not inside a <see cref="RoomSubScreen"/>.
/// </summary>
[CanBeNull]
[Resolved(typeof(Room), CanBeNull = true)]
protected IBindable<PlaylistItem> SelectedItem { get; private set; }
}
}