mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:52:54 +08:00
Combine SelectedItem
and CurrentPlaylistItem
into same storage
This commit is contained in:
parent
c6d78b9325
commit
bb1aa032bd
@ -388,7 +388,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
SelectedItem.BindValueChanged(onSelectedItemChanged, true);
|
CurrentPlaylistItem.BindValueChanged(onSelectedItemChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CancellationTokenSource beatmapLookupCancellation;
|
private CancellationTokenSource beatmapLookupCancellation;
|
||||||
|
@ -343,7 +343,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
drawablePlaylist.Items.BindTo(Playlist);
|
drawablePlaylist.Items.BindTo(Playlist);
|
||||||
drawablePlaylist.SelectedItem.BindTo(SelectedItem);
|
drawablePlaylist.SelectedItem.BindTo(CurrentPlaylistItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -419,7 +419,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
if (text.StartsWith(not_found_prefix, StringComparison.Ordinal))
|
if (text.StartsWith(not_found_prefix, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
ErrorText.Text = "The selected beatmap is not available online.";
|
ErrorText.Text = "The selected beatmap is not available online.";
|
||||||
SelectedItem.Value.MarkInvalid();
|
CurrentPlaylistItem.Value.MarkInvalid();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
SelectedItem.BindValueChanged(_ => updateState());
|
CurrentPlaylistItem.BindValueChanged(_ => updateState());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnRoomUpdated()
|
protected override void OnRoomUpdated()
|
||||||
@ -111,7 +111,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
|
|
||||||
bool enableButton =
|
bool enableButton =
|
||||||
Room?.State == MultiplayerRoomState.Open
|
Room?.State == MultiplayerRoomState.Open
|
||||||
&& SelectedItem.Value?.ID == Room.Settings.PlaylistItemId
|
&& CurrentPlaylistItem.Value?.ID == Room.Settings.PlaylistItemId
|
||||||
&& !Room.Playlist.Single(i => i.ID == Room.Settings.PlaylistItemId).Expired
|
&& !Room.Playlist.Single(i => i.ID == Room.Settings.PlaylistItemId).Expired
|
||||||
&& !operationInProgress.Value;
|
&& !operationInProgress.Value;
|
||||||
|
|
||||||
|
@ -52,14 +52,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
|
|||||||
queueList = new MultiplayerQueueList
|
queueList = new MultiplayerQueueList
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
SelectedItem = { BindTarget = SelectedItem },
|
SelectedItem = { BindTarget = CurrentPlaylistItem },
|
||||||
RequestEdit = item => RequestEdit?.Invoke(item)
|
RequestEdit = item => RequestEdit?.Invoke(item)
|
||||||
},
|
},
|
||||||
historyList = new MultiplayerHistoryList
|
historyList = new MultiplayerHistoryList
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
SelectedItem = { BindTarget = SelectedItem }
|
SelectedItem = { BindTarget = CurrentPlaylistItem }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,10 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected Bindable<MatchType> Type { get; private set; }
|
protected Bindable<MatchType> Type { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The currently selected item in the <see cref="RoomSubScreen"/>, or the current item from <see cref="Playlist"/>
|
||||||
|
/// if this <see cref="OnlinePlayComposite"/> is not within a <see cref="RoomSubScreen"/>.
|
||||||
|
/// </summary>
|
||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected Bindable<PlaylistItem> CurrentPlaylistItem { get; private set; }
|
protected Bindable<PlaylistItem> CurrentPlaylistItem { get; private set; }
|
||||||
|
|
||||||
@ -80,12 +84,6 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private IBindable<PlaylistItem> subScreenSelectedItem { get; set; }
|
private IBindable<PlaylistItem> subScreenSelectedItem { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The currently selected item in the <see cref="RoomSubScreen"/>, or the current item from <see cref="Playlist"/>
|
|
||||||
/// if this <see cref="OnlinePlayComposite"/> is not within a <see cref="RoomSubScreen"/>.
|
|
||||||
/// </summary>
|
|
||||||
protected readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -96,13 +94,11 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
protected void UpdateSelectedItem()
|
protected void UpdateSelectedItem()
|
||||||
{
|
{
|
||||||
if (RoomID.Value == null || subScreenSelectedItem == null)
|
// null room ID means this is a room in the process of being created.
|
||||||
{
|
if (RoomID.Value == null)
|
||||||
SelectedItem.Value = CurrentPlaylistItem.Value ?? Playlist.GetCurrentItem();
|
CurrentPlaylistItem.Value = Playlist.GetCurrentItem();
|
||||||
return;
|
else if (subScreenSelectedItem != null)
|
||||||
}
|
CurrentPlaylistItem.Value = subScreenSelectedItem.Value;
|
||||||
|
|
||||||
SelectedItem.Value = subScreenSelectedItem.Value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user