mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Replace Reset with overridden TransformImmediately/TransformDuration
This commit is contained in:
parent
fafec00667
commit
aed83471f4
@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
Size = new Vector2(40),
|
Size = new Vector2(40),
|
||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
},
|
},
|
||||||
avatar = new UpdateableAvatar
|
avatar = new UpdateableAvatar(transformImmediately: true)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -90,7 +90,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold)
|
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold)
|
||||||
},
|
},
|
||||||
flag = new UpdateableFlag
|
flag = new UpdateableFlag(transformImmediately: true)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
@ -116,7 +116,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
avatar.Reset();
|
|
||||||
avatar.User = value.User;
|
avatar.User = value.User;
|
||||||
flag.Country = value.User.Country;
|
flag.Country = value.User.Country;
|
||||||
date.Text = $@"achieved {value.Date.Humanize()}";
|
date.Text = $@"achieved {value.Date.Humanize()}";
|
||||||
|
@ -37,6 +37,10 @@ namespace osu.Game.Users.Drawables
|
|||||||
set => base.EdgeEffect = value;
|
set => base.EdgeEffect = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool TransformImmediately { get; }
|
||||||
|
|
||||||
|
protected override double TransformDuration { get; } = 1000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to show a default guest representation on null user (as opposed to nothing).
|
/// Whether to show a default guest representation on null user (as opposed to nothing).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -47,23 +51,14 @@ namespace osu.Game.Users.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableBool OpenOnClick = new BindableBool(true);
|
public readonly BindableBool OpenOnClick = new BindableBool(true);
|
||||||
|
|
||||||
public UpdateableAvatar(User user = null)
|
public UpdateableAvatar(User user = null, bool transformImmediately = false)
|
||||||
{
|
{
|
||||||
User = user;
|
User = user;
|
||||||
|
|
||||||
|
if (transformImmediately) {
|
||||||
|
TransformDuration = 0;
|
||||||
|
TransformImmediately = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fades and expires the <see cref="ModelBackedDrawable{T}.DisplayedDrawable"/>, and sets the
|
|
||||||
/// <see cref="ModelBackedDrawable{T}.Model"/> to null.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Can be used when the <see cref="ModelBackedDrawable{T}.DisplayedDrawable"/> needs to be removed instantly.
|
|
||||||
/// </remarks>
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
DisplayedDrawable?.FadeOut().Expire();
|
|
||||||
|
|
||||||
User = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateDrawable(User user)
|
protected override Drawable CreateDrawable(User user)
|
||||||
|
@ -14,14 +14,23 @@ namespace osu.Game.Users.Drawables
|
|||||||
set => Model = value;
|
set => Model = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool TransformImmediately { get; }
|
||||||
|
|
||||||
|
protected override double TransformDuration { get; } = 1000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to show a place holder on null country.
|
/// Whether to show a place holder on null country.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ShowPlaceholderOnNull = true;
|
public bool ShowPlaceholderOnNull = true;
|
||||||
|
|
||||||
public UpdateableFlag(Country country = null)
|
public UpdateableFlag(Country country = null, bool transformImmediately = false)
|
||||||
{
|
{
|
||||||
Country = country;
|
Country = country;
|
||||||
|
|
||||||
|
if (transformImmediately) {
|
||||||
|
TransformDuration = 0;
|
||||||
|
TransformImmediately = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateDrawable(Country country)
|
protected override Drawable CreateDrawable(Country country)
|
||||||
|
Loading…
Reference in New Issue
Block a user