Delay medal display when wanting to show results animation

This commit is contained in:
Bartłomiej Dach 2024-02-20 15:52:15 +01:00
parent 96825915f7
commit 611e3fe76b
No known key found for this signature in database
3 changed files with 16 additions and 2 deletions

View File

@ -54,7 +54,7 @@ protected override void LoadComplete()
OverlayActivationMode.BindValueChanged(val =>
{
if (val.NewValue != OverlayActivation.Disabled && (queuedMedals.Any() || medalContainer.Any()))
if (val.NewValue == OverlayActivation.All && (queuedMedals.Any() || medalContainer.Any()))
Show();
}, true);
}
@ -81,7 +81,8 @@ private void handleMedalMessages(SocketMessage obj)
var medalAnimation = new MedalAnimation(medal);
queuedMedals.Enqueue(medalAnimation);
Scheduler.AddOnce(Show);
if (OverlayActivationMode.Value == OverlayActivation.All)
Scheduler.AddOnce(Show);
}
protected override void Update()

View File

@ -31,6 +31,11 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
/// </summary>
public partial class AccuracyCircle : CompositeDrawable
{
/// <summary>
/// The total duration of the animation.
/// </summary>
public const double TOTAL_DURATION = APPEAR_DURATION + ACCURACY_TRANSFORM_DELAY + ACCURACY_TRANSFORM_DURATION;
/// <summary>
/// Duration for the transforms causing this component to appear.
/// </summary>

View File

@ -25,8 +25,10 @@
using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.Placeholders;
using osu.Game.Overlays;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osu.Game.Screens.Ranking.Statistics;
using osuTK;
@ -41,6 +43,8 @@ public abstract partial class ResultsScreen : ScreenWithBeatmapBackground, IKeyB
public override bool? AllowGlobalTrackControl => true;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
public readonly Bindable<ScoreInfo> SelectedScore = new Bindable<ScoreInfo>();
[CanBeNull]
@ -160,6 +164,10 @@ private void load(AudioManager audio)
bool shouldFlair = player != null && !Score.User.IsBot;
ScorePanelList.AddScore(Score, shouldFlair);
// this is mostly for medal display.
// we don't want the medal animation to trample on the results screen animation, so we (ab)use `OverlayActivationMode`
// to give the results screen enough time to play the animation out before the medals can be shown.
Scheduler.AddDelayed(() => OverlayActivationMode.Value = OverlayActivation.All, shouldFlair ? AccuracyCircle.TOTAL_DURATION + 1000 : 0);
}
if (allowWatchingReplay)