1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 00:47:24 +08:00

Avoid displaying previous user avatar when showing new beatmap… (#5112)

Avoid displaying previous user avatar when showing new beatmap overlay

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-06-25 10:31:36 +09:00 committed by GitHub
commit 109ca1fd6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Size = new Vector2(40),
FillMode = FillMode.Fit,
},
avatar = new UpdateableAvatar
avatar = new UpdateableAvatar(hideImmediately: true)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -90,7 +90,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold)
},
flag = new UpdateableFlag
flag = new UpdateableFlag(hideImmediately: true)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,

View File

@ -5,6 +5,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Transforms;
namespace osu.Game.Users.Drawables
{
@ -37,6 +38,8 @@ namespace osu.Game.Users.Drawables
set => base.EdgeEffect = value;
}
protected override bool TransformImmediately { get; }
/// <summary>
/// Whether to show a default guest representation on null user (as opposed to nothing).
/// </summary>
@ -47,11 +50,14 @@ namespace osu.Game.Users.Drawables
/// </summary>
public readonly BindableBool OpenOnClick = new BindableBool(true);
public UpdateableAvatar(User user = null)
public UpdateableAvatar(User user = null, bool hideImmediately = false)
{
TransformImmediately = hideImmediately;
User = user;
}
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable) => TransformImmediately ? drawable?.FadeOut() : base.ApplyHideTransforms(drawable);
protected override Drawable CreateDrawable(User user)
{
if (user == null && !ShowGuestOnNull)

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transforms;
namespace osu.Game.Users.Drawables
{
@ -14,16 +15,21 @@ namespace osu.Game.Users.Drawables
set => Model = value;
}
protected override bool TransformImmediately { get; }
/// <summary>
/// Whether to show a place holder on null country.
/// </summary>
public bool ShowPlaceholderOnNull = true;
public UpdateableFlag(Country country = null)
public UpdateableFlag(Country country = null, bool hideImmediately = false)
{
TransformImmediately = hideImmediately;
Country = country;
}
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable) => TransformImmediately ? drawable?.FadeOut() : base.ApplyHideTransforms(drawable);
protected override Drawable CreateDrawable(Country country)
{
if (country == null && !ShowPlaceholderOnNull)