From e47244989a230a845b4ea928dcec2a9a6e9faab0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jan 2025 19:23:54 +0900 Subject: [PATCH] Adjust animations a bit Removed autosize duration stuff because it looks weird when the list is shown from scratch where users are already fully populated in it. --- osu.Game/Screens/Play/HUD/SpectatorList.cs | 41 ++++++++++++++-------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/SpectatorList.cs b/osu.Game/Screens/Play/HUD/SpectatorList.cs index 7e928e1861..04bd03f153 100644 --- a/osu.Game/Screens/Play/HUD/SpectatorList.cs +++ b/osu.Game/Screens/Play/HUD/SpectatorList.cs @@ -51,8 +51,6 @@ namespace osu.Game.Screens.Play.HUD mainFlow = new FillFlowContainer { AutoSizeAxes = Axes.Both, - AutoSizeDuration = 250, - AutoSizeEasing = Easing.OutQuint, Direction = FillDirection.Vertical, Children = new Drawable[] { @@ -84,6 +82,8 @@ namespace osu.Game.Screens.Play.HUD Font.BindValueChanged(_ => updateAppearance()); HeaderColour.BindValueChanged(_ => updateAppearance(), true); FinishTransforms(true); + + this.FadeInFromZero(200, Easing.OutQuint); } private void onSpectatorsChanged(object? sender, NotifyCollectionChangedEventArgs e) @@ -100,11 +100,7 @@ namespace osu.Game.Screens.Play.HUD if (index >= max_spectators_displayed) break; - spectatorsFlow.Insert(e.NewStartingIndex + i, pool.Get(entry => - { - entry.Current.Value = spectator; - entry.UserPlayingState = UserPlayingState; - })); + addNewSpectatorToList(index, spectator); } break; @@ -120,14 +116,7 @@ namespace osu.Game.Screens.Play.HUD if (Spectators.Count >= max_spectators_displayed && spectatorsFlow.Count < max_spectators_displayed) { for (int i = spectatorsFlow.Count; i < max_spectators_displayed; i++) - { - var spectator = Spectators[i]; - spectatorsFlow.Insert(i, pool.Get(entry => - { - entry.Current.Value = spectator; - entry.UserPlayingState = UserPlayingState; - })); - } + addNewSpectatorToList(i, Spectators[i]); } break; @@ -154,6 +143,17 @@ namespace osu.Game.Screens.Play.HUD } } + private void addNewSpectatorToList(int i, Spectator spectator) + { + var entry = pool.Get(entry => + { + entry.Current.Value = spectator; + entry.UserPlayingState = UserPlayingState; + }); + + spectatorsFlow.Insert(i, entry); + } + private void updateVisibility() { mainFlow.FadeTo(Spectators.Count > 0 && UserPlayingState.Value != LocalUserPlayingState.NotPlaying ? 1 : 0, 250, Easing.OutQuint); @@ -203,6 +203,17 @@ namespace osu.Game.Screens.Play.HUD Current.BindValueChanged(_ => updateState(), true); } + protected override void PrepareForUse() + { + base.PrepareForUse(); + + username.MoveToX(10) + .Then() + .MoveToX(0, 400, Easing.OutQuint); + + this.FadeInFromZero(400, Easing.OutQuint); + } + private void updateState() { username.Text = Current.Value.Username;