1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 11:43:22 +08:00

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.
This commit is contained in:
Dean Herbert 2025-01-16 19:23:54 +09:00
parent 32906aefde
commit e47244989a
No known key found for this signature in database

View File

@ -51,8 +51,6 @@ namespace osu.Game.Screens.Play.HUD
mainFlow = new FillFlowContainer mainFlow = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
AutoSizeDuration = 250,
AutoSizeEasing = Easing.OutQuint,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -84,6 +82,8 @@ namespace osu.Game.Screens.Play.HUD
Font.BindValueChanged(_ => updateAppearance()); Font.BindValueChanged(_ => updateAppearance());
HeaderColour.BindValueChanged(_ => updateAppearance(), true); HeaderColour.BindValueChanged(_ => updateAppearance(), true);
FinishTransforms(true); FinishTransforms(true);
this.FadeInFromZero(200, Easing.OutQuint);
} }
private void onSpectatorsChanged(object? sender, NotifyCollectionChangedEventArgs e) private void onSpectatorsChanged(object? sender, NotifyCollectionChangedEventArgs e)
@ -100,11 +100,7 @@ namespace osu.Game.Screens.Play.HUD
if (index >= max_spectators_displayed) if (index >= max_spectators_displayed)
break; break;
spectatorsFlow.Insert(e.NewStartingIndex + i, pool.Get(entry => addNewSpectatorToList(index, spectator);
{
entry.Current.Value = spectator;
entry.UserPlayingState = UserPlayingState;
}));
} }
break; break;
@ -120,14 +116,7 @@ namespace osu.Game.Screens.Play.HUD
if (Spectators.Count >= max_spectators_displayed && spectatorsFlow.Count < max_spectators_displayed) if (Spectators.Count >= max_spectators_displayed && spectatorsFlow.Count < max_spectators_displayed)
{ {
for (int i = spectatorsFlow.Count; i < max_spectators_displayed; i++) for (int i = spectatorsFlow.Count; i < max_spectators_displayed; i++)
{ addNewSpectatorToList(i, Spectators[i]);
var spectator = Spectators[i];
spectatorsFlow.Insert(i, pool.Get(entry =>
{
entry.Current.Value = spectator;
entry.UserPlayingState = UserPlayingState;
}));
}
} }
break; 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() private void updateVisibility()
{ {
mainFlow.FadeTo(Spectators.Count > 0 && UserPlayingState.Value != LocalUserPlayingState.NotPlaying ? 1 : 0, 250, Easing.OutQuint); 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); 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() private void updateState()
{ {
username.Text = Current.Value.Username; username.Text = Current.Value.Username;