Add ShowPlaceholderOnNull in updateable flag + do not show placeholders in some overlays

This commit is contained in:
KingLuigi4932 2019-06-19 20:17:02 +03:00
parent 97dd34e26c
commit 5f5441c692
4 changed files with 24 additions and 5 deletions

View File

@ -135,7 +135,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
new UpdateableFlag(score.User.Country) { Size = new Vector2(20, 13) },
new UpdateableFlag(score.User.Country)
{
Size = new Vector2(20, 13),
ShowPlaceholderOnNull = false,
},
username
}
},

View File

@ -67,6 +67,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Offset = new Vector2(0, 2),
Radius = 1,
},
ShowGuestOnNull = false,
},
new FillFlowContainer
{
@ -94,6 +95,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(20, 13),
ShowPlaceholderOnNull = false,
},
}
}

View File

@ -60,6 +60,7 @@ namespace osu.Game.Overlays.Profile.Header
Masking = true,
CornerRadius = avatar_size * 0.25f,
OpenOnClick = { Value = false },
ShowGuestOnNull = false,
},
new Container
{
@ -118,7 +119,8 @@ namespace osu.Game.Overlays.Profile.Header
{
userFlag = new UpdateableFlag
{
Size = new Vector2(30, 20)
Size = new Vector2(30, 20),
ShowPlaceholderOnNull = false,
},
userCountryText = new OsuSpriteText
{

View File

@ -14,14 +14,25 @@ namespace osu.Game.Users.Drawables
set => Model = value;
}
/// <summary>
/// Whether to show a place holder on null country.
/// </summary>
public bool ShowPlaceholderOnNull = true;
public UpdateableFlag(Country country = null)
{
Country = country;
}
protected override Drawable CreateDrawable(Country country) => new DrawableFlag(country)
protected override Drawable CreateDrawable(Country country)
{
RelativeSizeAxes = Axes.Both,
};
if (country == null && !ShowPlaceholderOnNull)
return null;
return new DrawableFlag(country)
{
RelativeSizeAxes = Axes.Both,
};
}
}
}