mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:02:54 +08:00
Remove remaining Room!=null
checks in TestMultiplayerClient
where possible
This commit is contained in:
parent
9ed37621a7
commit
158f0a1f23
@ -87,8 +87,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
switch (Room?.MatchState)
|
switch (Room?.MatchState)
|
||||||
{
|
{
|
||||||
case TeamVersusRoomState teamVersus:
|
case TeamVersusRoomState teamVersus:
|
||||||
Debug.Assert(Room != null);
|
|
||||||
|
|
||||||
// simulate the server's automatic assignment of users to teams on join.
|
// simulate the server's automatic assignment of users to teams on join.
|
||||||
// the "best" team is the one with the least users on it.
|
// the "best" team is the one with the least users on it.
|
||||||
int bestTeam = teamVersus.Teams
|
int bestTeam = teamVersus.Teams
|
||||||
@ -103,6 +101,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
public void RemoveUser(APIUser user)
|
public void RemoveUser(APIUser user)
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
Debug.Assert(Room != null);
|
||||||
|
|
||||||
((IMultiplayerClient)this).UserLeft(new MultiplayerRoomUser(user.Id));
|
((IMultiplayerClient)this).UserLeft(new MultiplayerRoomUser(user.Id));
|
||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
@ -114,25 +113,23 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
public void ChangeRoomState(MultiplayerRoomState newState)
|
public void ChangeRoomState(MultiplayerRoomState newState)
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
|
||||||
((IMultiplayerClient)this).RoomStateChanged(newState);
|
((IMultiplayerClient)this).RoomStateChanged(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeUserState(int userId, MultiplayerUserState newState)
|
public void ChangeUserState(int userId, MultiplayerUserState newState)
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
|
||||||
|
|
||||||
((IMultiplayerClient)this).UserStateChanged(userId, newState);
|
((IMultiplayerClient)this).UserStateChanged(userId, newState);
|
||||||
updateRoomStateIfRequired();
|
updateRoomStateIfRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRoomStateIfRequired()
|
private void updateRoomStateIfRequired()
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
|
||||||
Debug.Assert(APIRoom != null);
|
Debug.Assert(APIRoom != null);
|
||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
|
Debug.Assert(Room != null);
|
||||||
|
|
||||||
switch (Room.State)
|
switch (Room.State)
|
||||||
{
|
{
|
||||||
case MultiplayerRoomState.Open:
|
case MultiplayerRoomState.Open:
|
||||||
@ -179,8 +176,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
public void ChangeUserBeatmapAvailability(int userId, BeatmapAvailability newBeatmapAvailability)
|
public void ChangeUserBeatmapAvailability(int userId, BeatmapAvailability newBeatmapAvailability)
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
|
||||||
|
|
||||||
((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(userId, newBeatmapAvailability);
|
((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(userId, newBeatmapAvailability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +285,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
public void ChangeUserMods(int userId, IEnumerable<APIMod> newMods)
|
public void ChangeUserMods(int userId, IEnumerable<APIMod> newMods)
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
|
||||||
((IMultiplayerClient)this).UserModsChanged(userId, newMods.ToList());
|
((IMultiplayerClient)this).UserModsChanged(userId, newMods.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +332,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
public override Task AbortGameplay()
|
public override Task AbortGameplay()
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
|
||||||
Debug.Assert(LocalUser != null);
|
Debug.Assert(LocalUser != null);
|
||||||
|
|
||||||
ChangeUserState(LocalUser.UserID, MultiplayerUserState.Idle);
|
ChangeUserState(LocalUser.UserID, MultiplayerUserState.Idle);
|
||||||
|
Loading…
Reference in New Issue
Block a user