mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Use single method for starting/restarting spectator screen
This commit is contained in:
@ -21,7 +21,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
if (client.Room != null)
|
if (client.Room != null && client.LocalUser?.State != MultiplayerUserState.Spectating)
|
||||||
client.ChangeState(MultiplayerUserState.Idle);
|
client.ChangeState(MultiplayerUserState.Idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,29 +406,22 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRoomUpdated() => Scheduler.Add(() =>
|
private void onRoomUpdated()
|
||||||
{
|
{
|
||||||
if (client.Room == null)
|
Scheduler.AddOnce(UpdateMods);
|
||||||
return;
|
}
|
||||||
|
|
||||||
Debug.Assert(client.LocalUser != null);
|
|
||||||
|
|
||||||
UpdateMods();
|
|
||||||
|
|
||||||
if (client.LocalUser.State == MultiplayerUserState.Spectating
|
|
||||||
&& (client.Room.State == MultiplayerRoomState.Playing || client.Room.State == MultiplayerRoomState.WaitingForLoad)
|
|
||||||
&& ParentScreen.IsCurrentScreen())
|
|
||||||
{
|
|
||||||
StartPlay();
|
|
||||||
|
|
||||||
// If the current user was host, they started the match and the in-progress operation needs to be stopped now.
|
|
||||||
readyClickOperation?.Dispose();
|
|
||||||
readyClickOperation = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
private void onLoadRequested()
|
private void onLoadRequested()
|
||||||
{
|
{
|
||||||
|
// If the user is spectating, the multi-spectator screen may still be the current screen.
|
||||||
|
if (!ParentScreen.IsCurrentScreen())
|
||||||
|
{
|
||||||
|
ParentScreen.MakeCurrent();
|
||||||
|
|
||||||
|
Schedule(onLoadRequested);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StartPlay();
|
StartPlay();
|
||||||
|
|
||||||
readyClickOperation?.Dispose();
|
readyClickOperation?.Dispose();
|
||||||
|
@ -140,6 +140,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
leaderboard.RemoveClock(userId);
|
leaderboard.RemoveClock(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool OnBackButton()
|
||||||
|
{
|
||||||
|
// On a manual exit, set the player state back to idle.
|
||||||
|
multiplayerClient.ChangeState(MultiplayerUserState.Idle);
|
||||||
|
return base.OnBackButton();
|
||||||
|
}
|
||||||
|
|
||||||
private int getIndexForUser(int userId) => Array.IndexOf(userIds, userId);
|
private int getIndexForUser(int userId) => Array.IndexOf(userIds, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user