1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-17 22:17:25 +08:00

Make loadedReplies dictionary private

This commit is contained in:
Andrei Zavatski 2020-02-13 02:37:41 +03:00
parent 5201c1c87b
commit c6f8e157fd
2 changed files with 6 additions and 4 deletions

View File

@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Comments
// We may receive already loaded comments
receivedComments.ForEach(c =>
{
if (!drawableComment.LoadedReplies.ContainsKey(c.Id))
if (!drawableComment.ContainsReply(c.Id))
uniqueComments.Add(c);
});

View File

@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Comments
public readonly BindableBool ShowDeleted = new BindableBool();
public readonly Bindable<CommentsSortCriteria> Sort = new Bindable<CommentsSortCriteria>();
public readonly Dictionary<long, Comment> LoadedReplies = new Dictionary<long, Comment>();
private readonly Dictionary<long, Comment> loadedReplies = new Dictionary<long, Comment>();
/// <summary>
/// <see cref="DrawableComment"/>s which will be added to this <see cref="DrawableComment"/> as replies on initial load.
@ -290,6 +290,8 @@ namespace osu.Game.Overlays.Comments
base.LoadComplete();
}
public bool ContainsReply(long replyId) => loadedReplies.ContainsKey(replyId);
public void AddReplies(IEnumerable<DrawableComment> replies)
{
if (LoadState == LoadState.NotLoaded)
@ -311,7 +313,7 @@ namespace osu.Game.Overlays.Comments
childCommentsContainer.Add(page);
var newReplies = replies.Select(reply => reply.Comment);
newReplies.ForEach(reply => LoadedReplies.Add(reply.Id, reply));
newReplies.ForEach(reply => loadedReplies.Add(reply.Id, reply));
deletedCommentsCounter.Count.Value += newReplies.Count(reply => reply.IsDeleted);
updateButtonsState();
}
@ -326,7 +328,7 @@ namespace osu.Game.Overlays.Comments
private void updateButtonsState()
{
var loadedReplesCount = LoadedReplies.Count;
var loadedReplesCount = loadedReplies.Count;
var hasUnloadedReplies = loadedReplesCount != Comment.RepliesCount;
loadMoreCommentsButton.FadeTo(hasUnloadedReplies && loadedReplesCount == 0 ? 1 : 0);