Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch online statistics changes after every play & display them in toolbar #27156

Merged
merged 11 commits into from
Feb 14, 2024
Prev Previous commit
Next Next commit
Cancel rolling properly
  • Loading branch information
bdach committed Feb 14, 2024
commit aae431e8f6f414abe1155f005d33cf111493220d
22 changes: 15 additions & 7 deletions osu.Game/Overlays/Toolbar/TransientUserStatisticsUpdateDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Threading;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
Expand Down Expand Up @@ -98,6 +99,7 @@ private partial class Statistic<T> : CompositeDrawable
private Counter<T> mainValue = null!;
private Counter<T> deltaValue = null!;
private OsuSpriteText titleText = null!;
private ScheduledDelegate? valueUpdateSchedule;

[Resolved]
private OsuColour colours { get; set; } = null!;
Expand Down Expand Up @@ -159,6 +161,9 @@ private void load()

public void Display(T before, T delta, T after)
{
valueUpdateSchedule?.Cancel();
valueUpdateSchedule = null;

int comparison = valueComparer.Compare(before, after);

if (comparison > 0)
Expand Down Expand Up @@ -186,13 +191,16 @@ public void Display(T before, T delta, T after)
using (BeginDelayedSequence(1200))
{
titleText.FadeOut(250, Easing.OutQuad);
deltaValue.FadeIn(250, Easing.OutQuad)
.Then().Delay(500)
.Then().Schedule(() =>
{
mainValue.Current.Value = after;
deltaValue.Current.SetDefault();
});
deltaValue.FadeIn(250, Easing.OutQuad);

using (BeginDelayedSequence(1250))
{
valueUpdateSchedule = Schedule(() =>
{
mainValue.Current.Value = after;
deltaValue.Current.SetDefault();
});
}
}
}
}
Expand Down
Loading