Track comment's nesting and reduce padding for too nested

This commit is contained in:
ansel
2023-01-18 02:11:07 +03:00
parent 12544c16ea
commit ca3be71381

View File

@ -57,6 +57,11 @@ namespace osu.Game.Overlays.Comments
/// </summary> /// </summary>
public bool WasDeleted { get; protected set; } public bool WasDeleted { get; protected set; }
/// <summary>
/// Tracks this comment's level of nesting. 0 means that this comment has no parents.
/// </summary>
public int Level { get; private set; }
private FillFlowContainer childCommentsVisibilityContainer = null!; private FillFlowContainer childCommentsVisibilityContainer = null!;
private FillFlowContainer childCommentsContainer = null!; private FillFlowContainer childCommentsContainer = null!;
private LoadRepliesButton loadRepliesButton = null!; private LoadRepliesButton loadRepliesButton = null!;
@ -88,12 +93,16 @@ namespace osu.Game.Overlays.Comments
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider) private void load(OverlayColourProvider colourProvider, DrawableComment? parentComment)
{ {
LinkFlowContainer username; LinkFlowContainer username;
FillFlowContainer info; FillFlowContainer info;
CommentMarkdownContainer message; CommentMarkdownContainer message;
Level = parentComment?.Level + 1 ?? 0;
float childrenPadding = Level < 6 ? 20 : 5;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
@ -248,7 +257,7 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Padding = new MarginPadding { Left = 20 }, Padding = new MarginPadding { Left = childrenPadding },
Children = new Drawable[] Children = new Drawable[]
{ {
childCommentsContainer = new FillFlowContainer childCommentsContainer = new FillFlowContainer