mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 06:07:11 +09:00
Refactor NoCommentsPlaceholder
This commit is contained in:
@ -35,7 +35,6 @@ namespace osu.Game.Overlays.Comments
|
||||
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
||||
private CommentsShowMoreButton moreButton;
|
||||
private TotalCommentsCounter commentCounter;
|
||||
private Container noCommentsPlaceholder;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
@ -62,27 +61,6 @@ namespace osu.Game.Overlays.Comments
|
||||
Sort = { BindTarget = Sort },
|
||||
ShowDeleted = { BindTarget = ShowDeleted }
|
||||
},
|
||||
noCommentsPlaceholder = new Container
|
||||
{
|
||||
Height = 80,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Alpha = 0,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background4
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding { Left = 50 },
|
||||
Text = @"No comments yet."
|
||||
}
|
||||
}
|
||||
},
|
||||
content = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -181,14 +159,13 @@ namespace osu.Game.Overlays.Comments
|
||||
moreButton.Show();
|
||||
moreButton.IsLoading = true;
|
||||
content.Clear();
|
||||
noCommentsPlaceholder.Hide();
|
||||
}
|
||||
|
||||
private void onSuccess(CommentBundle response)
|
||||
{
|
||||
if (!response.Comments.Any())
|
||||
{
|
||||
noCommentsPlaceholder.Show();
|
||||
content.Add(new NoCommentsPlaceholder());
|
||||
moreButton.Hide();
|
||||
return;
|
||||
}
|
||||
@ -240,5 +217,30 @@ namespace osu.Game.Overlays.Comments
|
||||
loadCancellation?.Cancel();
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
private class NoCommentsPlaceholder : CompositeDrawable
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
Height = 80;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background4
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding { Left = 50 },
|
||||
Text = @"No comments yet."
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user