mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 08:12:56 +08:00
Add support for null item display in DrawableRoomPlaylistItem
This commit is contained in:
parent
23dd21339d
commit
695167a749
@ -50,6 +50,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
private LinkFlowContainer authorText;
|
private LinkFlowContainer authorText;
|
||||||
private ExplicitContentBeatmapPill explicitContentPill;
|
private ExplicitContentBeatmapPill explicitContentPill;
|
||||||
private ModDisplay modDisplay;
|
private ModDisplay modDisplay;
|
||||||
|
private FillFlowContainer buttonsFlow;
|
||||||
private UpdateableAvatar ownerAvatar;
|
private UpdateableAvatar ownerAvatar;
|
||||||
|
|
||||||
private readonly IBindable<bool> valid = new Bindable<bool>();
|
private readonly IBindable<bool> valid = new Bindable<bool>();
|
||||||
@ -150,15 +151,22 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
.ContinueWith(u => Schedule(() => ownerAvatar.User = u.Result), TaskContinuationOptions.OnlyOnRanToCompletion);
|
.ContinueWith(u => Schedule(() => ownerAvatar.User = u.Result), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Item.Beatmap.Value != null)
|
||||||
difficultyIconContainer.Child = new DifficultyIcon(Item.Beatmap.Value, ruleset.Value, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(ICON_HEIGHT) };
|
difficultyIconContainer.Child = new DifficultyIcon(Item.Beatmap.Value, ruleset.Value, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(ICON_HEIGHT) };
|
||||||
|
else
|
||||||
|
difficultyIconContainer.Clear();
|
||||||
|
|
||||||
panelBackground.Beatmap.Value = Item.Beatmap.Value;
|
panelBackground.Beatmap.Value = Item.Beatmap.Value;
|
||||||
|
|
||||||
beatmapText.Clear();
|
beatmapText.Clear();
|
||||||
|
|
||||||
|
if (Item.Beatmap.Value != null)
|
||||||
|
{
|
||||||
beatmapText.AddLink(Item.Beatmap.Value.GetDisplayTitleRomanisable(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineID.ToString(), null, text =>
|
beatmapText.AddLink(Item.Beatmap.Value.GetDisplayTitleRomanisable(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineID.ToString(), null, text =>
|
||||||
{
|
{
|
||||||
text.Truncate = true;
|
text.Truncate = true;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
authorText.Clear();
|
authorText.Clear();
|
||||||
|
|
||||||
@ -168,10 +176,13 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
authorText.AddUserLink(Item.Beatmap.Value.Metadata.Author);
|
authorText.AddUserLink(Item.Beatmap.Value.Metadata.Author);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasExplicitContent = (Item.Beatmap.Value.BeatmapSet as IBeatmapSetOnlineInfo)?.HasExplicitContent == true;
|
bool hasExplicitContent = (Item.Beatmap.Value?.BeatmapSet as IBeatmapSetOnlineInfo)?.HasExplicitContent == true;
|
||||||
explicitContentPill.Alpha = hasExplicitContent ? 1 : 0;
|
explicitContentPill.Alpha = hasExplicitContent ? 1 : 0;
|
||||||
|
|
||||||
modDisplay.Current.Value = requiredMods.ToArray();
|
modDisplay.Current.Value = requiredMods.ToArray();
|
||||||
|
|
||||||
|
buttonsFlow.Clear();
|
||||||
|
buttonsFlow.ChildrenEnumerable = CreateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateContent()
|
protected override Drawable CreateContent()
|
||||||
@ -273,7 +284,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
buttonsFlow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
@ -305,9 +316,9 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected virtual IEnumerable<Drawable> CreateButtons() =>
|
protected virtual IEnumerable<Drawable> CreateButtons() =>
|
||||||
new Drawable[]
|
new[]
|
||||||
{
|
{
|
||||||
new PlaylistDownloadButton(Item),
|
Item.Beatmap.Value == null ? Empty() : new PlaylistDownloadButton(Item),
|
||||||
new PlaylistRemoveButton
|
new PlaylistRemoveButton
|
||||||
{
|
{
|
||||||
Size = new Vector2(30, 30),
|
Size = new Vector2(30, 30),
|
||||||
|
Loading…
Reference in New Issue
Block a user