From fafec006676c996f21580392344ffd940b4b671f Mon Sep 17 00:00:00 2001 From: HoLLy Date: Fri, 21 Jun 2019 16:47:19 +0200 Subject: [PATCH] Reset top score avatar before updating it --- .../BeatmapSet/Scores/TopScoreUserSection.cs | 1 + osu.Game/Users/Drawables/UpdateableAvatar.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index 5ee143850f..a441d544d1 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -116,6 +116,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { set { + avatar.Reset(); avatar.User = value.User; flag.Country = value.User.Country; date.Text = $@"achieved {value.Date.Humanize()}"; diff --git a/osu.Game/Users/Drawables/UpdateableAvatar.cs b/osu.Game/Users/Drawables/UpdateableAvatar.cs index 795b90ba11..87a6943e80 100644 --- a/osu.Game/Users/Drawables/UpdateableAvatar.cs +++ b/osu.Game/Users/Drawables/UpdateableAvatar.cs @@ -52,6 +52,20 @@ namespace osu.Game.Users.Drawables User = user; } + /// + /// Fades and expires the , and sets the + /// to null. + /// + /// + /// Can be used when the needs to be removed instantly. + /// + public void Reset() + { + DisplayedDrawable?.FadeOut().Expire(); + + User = null; + } + protected override Drawable CreateDrawable(User user) { if (user == null && !ShowGuestOnNull)