mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 03:02:59 +08:00
Reorder file
This commit is contained in:
parent
4fd420e61d
commit
4c3468f40e
@ -64,6 +64,28 @@ namespace osu.Game.Overlays.Comments
|
|||||||
appendComments(null, commentBundle);
|
appendComments(null, commentBundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DrawableComment getDrawableComment(Comment comment)
|
||||||
|
{
|
||||||
|
if (commentDictionary.TryGetValue(comment.Id, out var existing))
|
||||||
|
return existing;
|
||||||
|
|
||||||
|
return commentDictionary[comment.Id] = new DrawableComment(comment)
|
||||||
|
{
|
||||||
|
ShowDeleted = { BindTarget = ShowDeleted },
|
||||||
|
Sort = { BindTarget = Sort },
|
||||||
|
RepliesRequested = onCommentRepliesRequested
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onCommentRepliesRequested(DrawableComment drawableComment, int page)
|
||||||
|
{
|
||||||
|
var request = new GetCommentsRequest(CommentableId.Value, Type.Value, Sort.Value, page, drawableComment.Comment.Id);
|
||||||
|
|
||||||
|
request.Success += response => Schedule(() => appendComments(drawableComment, response));
|
||||||
|
|
||||||
|
api.PerformAsync(request);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Dictionary<long, DrawableComment> commentDictionary = new Dictionary<long, DrawableComment>();
|
private readonly Dictionary<long, DrawableComment> commentDictionary = new Dictionary<long, DrawableComment>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -115,28 +137,6 @@ namespace osu.Game.Overlays.Comments
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DrawableComment getDrawableComment(Comment comment)
|
|
||||||
{
|
|
||||||
if (commentDictionary.TryGetValue(comment.Id, out var existing))
|
|
||||||
return existing;
|
|
||||||
|
|
||||||
return commentDictionary[comment.Id] = new DrawableComment(comment)
|
|
||||||
{
|
|
||||||
ShowDeleted = { BindTarget = ShowDeleted },
|
|
||||||
Sort = { BindTarget = Sort },
|
|
||||||
RepliesRequested = onCommentRepliesRequested
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onCommentRepliesRequested(DrawableComment drawableComment, int page)
|
|
||||||
{
|
|
||||||
var request = new GetCommentsRequest(CommentableId.Value, Type.Value, Sort.Value, page, drawableComment.Comment.Id);
|
|
||||||
|
|
||||||
request.Success += response => Schedule(() => appendComments(drawableComment, response));
|
|
||||||
|
|
||||||
api.PerformAsync(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class NoCommentsPlaceholder : CompositeDrawable
|
private class NoCommentsPlaceholder : CompositeDrawable
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
Loading…
Reference in New Issue
Block a user