1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 01:37:46 +08:00

Remove now unnecessary schedule

This commit is contained in:
smoogipoo 2021-02-19 13:23:01 +09:00
parent e911760318
commit bc10fcafae

View File

@ -47,7 +47,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
private Drawable userModsSection; private Drawable userModsSection;
private readonly IBindable<bool> isConnected = new Bindable<bool>(); private readonly IBindable<bool> isConnected = new Bindable<bool>();
private readonly IBindable<PlaylistItem> matchCurrentItem = new Bindable<PlaylistItem>();
[CanBeNull] [CanBeNull]
private IDisposable readyClickOperation; private IDisposable readyClickOperation;
@ -269,8 +268,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{ {
base.LoadComplete(); base.LoadComplete();
matchCurrentItem.BindTo(client.CurrentMatchPlayingItem); SelectedItem.BindTo(client.CurrentMatchPlayingItem);
matchCurrentItem.BindValueChanged(onCurrentItemChanged, true); SelectedItem.BindValueChanged(onSelectedItemChanged, true);
BeatmapAvailability.BindValueChanged(updateBeatmapAvailability, true); BeatmapAvailability.BindValueChanged(updateBeatmapAvailability, true);
UserMods.BindValueChanged(onUserModsChanged); UserMods.BindValueChanged(onUserModsChanged);
@ -286,20 +285,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
}, true); }, true);
} }
private void onCurrentItemChanged(ValueChangedEvent<PlaylistItem> item) private void onSelectedItemChanged(ValueChangedEvent<PlaylistItem> item)
{ {
if (client?.LocalUser == null) if (client?.LocalUser == null)
return; return;
// If we're about to enter gameplay, schedule the item to be set at a later time.
if (client.LocalUser.State > MultiplayerUserState.Ready)
{
Schedule(() => onCurrentItemChanged(item));
return;
}
SelectedItem.Value = item.NewValue;
if (item.NewValue?.AllowedMods.Any() != true) if (item.NewValue?.AllowedMods.Any() != true)
{ {
userModsSection.Hide(); userModsSection.Hide();