1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 15:42:55 +08:00

Fix TeamDisplay not showing after changing to team versus

This commit is contained in:
Dean Herbert 2021-11-10 13:38:02 +09:00
parent 52c740b377
commit 328c72c358

View File

@ -29,23 +29,30 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
private OsuClickableContainer clickableContent;
public TeamDisplay(MultiplayerRoomUser user) public TeamDisplay(MultiplayerRoomUser user)
{ {
this.user = user; this.user = user;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Width = 15;
AutoSizeAxes = Axes.X;
Margin = new MarginPadding { Horizontal = 3 }; Margin = new MarginPadding { Horizontal = 3 };
Alpha = 0;
Scale = new Vector2(0, 1);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
box = new Container InternalChild = clickableContent = new OsuClickableContainer
{
Width = 15,
Alpha = 0,
Scale = new Vector2(0, 1),
RelativeSizeAxes = Axes.Y,
Action = changeTeam,
Child = box = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
CornerRadius = 5, CornerRadius = 5,
@ -60,21 +67,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
} }
}
}; };
if (Client.LocalUser?.Equals(user) == true) if (Client.LocalUser?.Equals(user) == true)
{ {
InternalChild = new OsuClickableContainer clickableContent.Action = changeTeam;
{ clickableContent.TooltipText = "Change team";
RelativeSizeAxes = Axes.Both,
TooltipText = "Change team",
Action = changeTeam,
Child = box
};
}
else
{
InternalChild = box;
} }
sampleTeamSwap = audio.Samples.Get(@"Multiplayer/team-swap"); sampleTeamSwap = audio.Samples.Get(@"Multiplayer/team-swap");
@ -117,13 +116,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
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); box.ScaleTo(new Vector2(box.Scale.X < 0 ? 1 : -1, 1), duration, Easing.OutQuint);
this.ScaleTo(Vector2.One, duration, Easing.OutQuint); clickableContent.ScaleTo(Vector2.One, duration, Easing.OutQuint);
this.FadeIn(duration); clickableContent.FadeIn(duration);
} }
else else
{ {
this.ScaleTo(new Vector2(0, 1), duration, Easing.OutQuint); clickableContent.ScaleTo(new Vector2(0, 1), duration, Easing.OutQuint);
this.FadeOut(duration); clickableContent.FadeOut(duration);
} }
} }