This commit is contained in:
Andrei Zavatski
2019-10-14 16:43:43 +03:00
parent 7ac87494e0
commit 7cd3f5656d
6 changed files with 18 additions and 28 deletions

View File

@ -16,8 +16,6 @@ namespace osu.Game.Overlays.Comments
{
public class CommentsContainer : CompositeDrawable
{
private const int more_button_margin = 5;
private readonly CommentableType type;
private readonly long id;
@ -101,7 +99,7 @@ namespace osu.Game.Overlays.Comments
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Margin = new MarginPadding(more_button_margin),
Margin = new MarginPadding(5),
Action = () => getComments(false),
}
}

View File

@ -12,9 +12,6 @@ namespace osu.Game.Overlays.Comments
{
public class DeletedChildsPlaceholder : FillFlowContainer
{
private const int deleted_placeholder_margin = 80;
private const int margin = 10;
public readonly BindableBool ShowDeleted = new BindableBool();
public readonly BindableInt DeletedCount = new BindableInt();
@ -27,7 +24,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
Spacing = new Vector2(3, 0);
Margin = new MarginPadding { Vertical = margin, Left = deleted_placeholder_margin };
Margin = new MarginPadding { Vertical = 10, Left = 80 };
Children = new Drawable[]
{
new SpriteIcon

View File

@ -21,18 +21,14 @@ namespace osu.Game.Overlays.Comments
{
private const int avatar_size = 40;
private const int margin = 10;
private const int child_margin = 20;
private const int chevron_margin = 30;
private const int message_padding = 40;
private const float separator_height = 1.5f;
public readonly BindableBool ShowDeleted = new BindableBool();
private readonly BindableBool childExpanded = new BindableBool(true);
private readonly FillFlowContainer childCommentsVisibilityContainer;
private readonly Comment comment;
private readonly DeletedChildsPlaceholder deletedChildsPlaceholder;
private readonly Comment comment;
public DrawableComment(Comment comment)
{
@ -127,7 +123,7 @@ namespace osu.Game.Overlays.Comments
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Right = message_padding }
Padding = new MarginPadding { Right = 40 }
},
info = new FillFlowContainer
{
@ -164,7 +160,7 @@ namespace osu.Game.Overlays.Comments
{
childCommentsContainer = new FillFlowContainer
{
Margin = new MarginPadding { Left = child_margin },
Margin = new MarginPadding { Left = 20 },
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical
@ -180,10 +176,10 @@ namespace osu.Game.Overlays.Comments
deletedChildsPlaceholder.DeletedCount.Value = comment.GetDeletedChildsCount();
if (comment.UserId == null)
username.AddText(comment.LegacyName);
else
if (comment.UserId.HasValue)
username.AddUserLink(comment.User);
else
username.AddText(comment.LegacyName);
if (comment.EditedAt.HasValue)
{
@ -209,7 +205,7 @@ namespace osu.Game.Overlays.Comments
AddInternal(new Container
{
RelativeSizeAxes = Axes.X,
Height = separator_height,
Height = 1.5f,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Child = new Box
@ -225,7 +221,7 @@ namespace osu.Game.Overlays.Comments
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Margin = new MarginPadding { Right = chevron_margin, Top = margin },
Margin = new MarginPadding { Right = 30, Top = margin },
Expanded = { BindTarget = childExpanded }
});
}
@ -240,15 +236,10 @@ namespace osu.Game.Overlays.Comments
protected override void LoadComplete()
{
ShowDeleted.BindValueChanged(onShowDeletedChanged, true);
childExpanded.BindValueChanged(onChildExpandedChanged, true);
childExpanded.BindValueChanged(expanded => childCommentsVisibilityContainer.FadeTo(expanded.NewValue ? 1 : 0), true);
base.LoadComplete();
}
private void onChildExpandedChanged(ValueChangedEvent<bool> expanded)
{
childCommentsVisibilityContainer.FadeTo(expanded.NewValue ? 1 : 0);
}
private void onShowDeletedChanged(ValueChangedEvent<bool> show)
{
if (comment.IsDeleted)

View File

@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Comments
protected override bool OnClick(ClickEvent e)
{
Expanded.Value = !Expanded.Value;
return base.OnClick(e);
return true;
}
}
}