mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:33:21 +08:00
Integrate editor into comment
This commit is contained in:
parent
0d91277ea5
commit
77bc4fbf70
@ -75,6 +75,7 @@ namespace osu.Game.Overlays.Comments
|
||||
private OsuSpriteText deletedLabel = null!;
|
||||
private GridContainer content = null!;
|
||||
private VotePill votePill = null!;
|
||||
private Container<CommentEditor> replyEditorContainer = null!;
|
||||
|
||||
[Resolved]
|
||||
private IDialogOverlay? dialogOverlay { get; set; }
|
||||
@ -233,6 +234,12 @@ namespace osu.Game.Overlays.Comments
|
||||
}
|
||||
}
|
||||
},
|
||||
replyEditorContainer = new Container<CommentEditor>
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Padding = new MarginPadding { Top = 10 },
|
||||
},
|
||||
new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
@ -255,6 +262,7 @@ namespace osu.Game.Overlays.Comments
|
||||
},
|
||||
childCommentsVisibilityContainer = new FillFlowContainer
|
||||
{
|
||||
Name = @"Children comments",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
@ -345,6 +353,8 @@ namespace osu.Game.Overlays.Comments
|
||||
|
||||
actionsContainer.AddLink(CommonStrings.ButtonsPermalink, copyUrl);
|
||||
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
|
||||
actionsContainer.AddLink(CommonStrings.ButtonsReply.ToLower(), toggleReply);
|
||||
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
|
||||
|
||||
if (Comment.UserId.HasValue && Comment.UserId.Value == api.LocalUser.Value.Id)
|
||||
actionsContainer.AddLink(CommonStrings.ButtonsDelete.ToLower(), deleteComment);
|
||||
@ -435,6 +445,26 @@ namespace osu.Game.Overlays.Comments
|
||||
onScreenDisplay?.Display(new CopyUrlToast());
|
||||
}
|
||||
|
||||
private void toggleReply()
|
||||
{
|
||||
if (replyEditorContainer.Count == 0)
|
||||
{
|
||||
replyEditorContainer.Add(new ReplyCommentEditor(Comment)
|
||||
{
|
||||
OnPost = comments =>
|
||||
{
|
||||
Comment.RepliesCount += comments.Length;
|
||||
showRepliesButton.Count = Comment.RepliesCount;
|
||||
Replies.AddRange(comments);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
replyEditorContainer.Clear(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
ShowDeleted.BindValueChanged(show =>
|
||||
|
Loading…
Reference in New Issue
Block a user