1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 22:27:46 +08:00

Add failing test showing team display display failure

This commit is contained in:
Dean Herbert 2021-11-10 13:44:24 +09:00
parent baa5285b59
commit 52c740b377
2 changed files with 10 additions and 6 deletions

View File

@ -127,9 +127,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddAssert("room type is head to head", () => client.Room?.Settings.MatchType == MatchType.HeadToHead);
AddUntilStep("team displays are not displaying teams", () => multiplayerScreenStack.ChildrenOfType<TeamDisplay>().All(d => d.DisplayedTeam == null));
AddStep("change to team vs", () => client.ChangeSettings(matchType: MatchType.TeamVersus));
AddAssert("room type is team vs", () => client.Room?.Settings.MatchType == MatchType.TeamVersus);
AddUntilStep("team displays are displaying teams", () => multiplayerScreenStack.ChildrenOfType<TeamDisplay>().All(d => d.DisplayedTeam != null));
}
private void createRoom(Func<Room> room)

View File

@ -88,7 +88,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
});
}
private int? displayedTeam;
public int? DisplayedTeam { get; private set; }
protected override void OnRoomUpdated()
{
@ -102,19 +102,19 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
int? newTeam = (userRoomState as TeamVersusUserState)?.TeamID;
if (newTeam == displayedTeam)
if (newTeam == DisplayedTeam)
return;
// only play the sample if an already valid team changes to another valid team.
// this avoids playing a sound for each user if the match type is changed to/from a team mode.
if (newTeam != null && displayedTeam != null)
if (newTeam != null && DisplayedTeam != null)
sampleTeamSwap?.Play();
displayedTeam = newTeam;
DisplayedTeam = newTeam;
if (displayedTeam != null)
if (DisplayedTeam != null)
{
box.FadeColour(getColourForTeam(displayedTeam.Value), duration, Easing.OutQuint);
box.FadeColour(getColourForTeam(DisplayedTeam.Value), duration, Easing.OutQuint);
box.ScaleTo(new Vector2(box.Scale.X < 0 ? 1 : -1, 1), duration, Easing.OutQuint);
this.ScaleTo(Vector2.One, duration, Easing.OutQuint);