mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 14:17:06 +09:00
Make BeatmapSetOverlay accept nulls everywhere
This commit is contained in:
@ -23,9 +23,8 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
private readonly ClickableArea clickableArea;
|
||||
private readonly FillFlowContainer fields;
|
||||
|
||||
private UserProfileOverlay profile;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
{
|
||||
get { return beatmapSet; }
|
||||
@ -34,28 +33,36 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
if (value == beatmapSet) return;
|
||||
beatmapSet = value;
|
||||
|
||||
var i = BeatmapSet.OnlineInfo;
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
avatar.User = BeatmapSet.Metadata.Author;
|
||||
clickableArea.Action = () => profile?.ShowUser(avatar.User);
|
||||
private void updateDisplay()
|
||||
{
|
||||
avatar.User = BeatmapSet?.Metadata.Author;
|
||||
|
||||
fields.Children = new Drawable[]
|
||||
{
|
||||
new Field("made by", BeatmapSet.Metadata.Author.Username, @"Exo2.0-RegularItalic"),
|
||||
new Field("submitted on", i.Submitted.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold")
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
},
|
||||
};
|
||||
fields.Clear();
|
||||
if (BeatmapSet == null)
|
||||
return;
|
||||
|
||||
if (i.Ranked.HasValue)
|
||||
var online = BeatmapSet.OnlineInfo;
|
||||
|
||||
fields.Children = new Drawable[]
|
||||
{
|
||||
new Field("made by", BeatmapSet.Metadata.Author.Username, @"Exo2.0-RegularItalic"),
|
||||
new Field("submitted on", online.Submitted.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold")
|
||||
{
|
||||
fields.Add(new Field("ranked on ", i.Ranked.Value.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold"));
|
||||
}
|
||||
else if (i.LastUpdated.HasValue)
|
||||
{
|
||||
fields.Add(new Field("last updated on ", i.LastUpdated.Value.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold"));
|
||||
}
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
},
|
||||
};
|
||||
|
||||
if (online.Ranked.HasValue)
|
||||
{
|
||||
fields.Add(new Field("ranked on ", online.Ranked.Value.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold"));
|
||||
}
|
||||
else if (online.LastUpdated.HasValue)
|
||||
{
|
||||
fields.Add(new Field("last updated on ", online.LastUpdated.Value.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +80,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Masking = true,
|
||||
Child = avatar = new UpdateableAvatar
|
||||
{
|
||||
ShowGuestOnNull = false,
|
||||
Size = new Vector2(height),
|
||||
},
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
@ -95,8 +103,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(UserProfileOverlay profile)
|
||||
{
|
||||
this.profile = profile;
|
||||
clickableArea.Action = () => profile?.ShowUser(avatar.User);
|
||||
clickableArea.Action = () =>
|
||||
{
|
||||
if (avatar.User != null) profile?.ShowUser(avatar.User);
|
||||
};
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
private class Field : FillFlowContainer
|
||||
|
Reference in New Issue
Block a user