mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Refactor NoCommentsPlaceholder
This commit is contained in:
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
|
AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
|
||||||
AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
|
AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
|
||||||
AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
|
AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
|
||||||
AddStep("Beatmap with no comments", () => comments.ShowComments(CommentableType.Beatmapset, 1291));
|
AddStep("Beatmap with no comments", () => comments.ShowComments(CommentableType.Beatmapset, 1288));
|
||||||
AddStep("Idle state", () =>
|
AddStep("Idle state", () =>
|
||||||
{
|
{
|
||||||
scroll.Clear();
|
scroll.Clear();
|
||||||
|
@ -35,7 +35,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
||||||
private CommentsShowMoreButton moreButton;
|
private CommentsShowMoreButton moreButton;
|
||||||
private TotalCommentsCounter commentCounter;
|
private TotalCommentsCounter commentCounter;
|
||||||
private Container noCommentsPlaceholder;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
@ -62,27 +61,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Sort = { BindTarget = Sort },
|
Sort = { BindTarget = Sort },
|
||||||
ShowDeleted = { BindTarget = ShowDeleted }
|
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
|
content = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -181,14 +159,13 @@ namespace osu.Game.Overlays.Comments
|
|||||||
moreButton.Show();
|
moreButton.Show();
|
||||||
moreButton.IsLoading = true;
|
moreButton.IsLoading = true;
|
||||||
content.Clear();
|
content.Clear();
|
||||||
noCommentsPlaceholder.Hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSuccess(CommentBundle response)
|
private void onSuccess(CommentBundle response)
|
||||||
{
|
{
|
||||||
if (!response.Comments.Any())
|
if (!response.Comments.Any())
|
||||||
{
|
{
|
||||||
noCommentsPlaceholder.Show();
|
content.Add(new NoCommentsPlaceholder());
|
||||||
moreButton.Hide();
|
moreButton.Hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -240,5 +217,30 @@ namespace osu.Game.Overlays.Comments
|
|||||||
loadCancellation?.Cancel();
|
loadCancellation?.Cancel();
|
||||||
base.Dispose(isDisposing);
|
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