From 6493f24547bd1eae1ecbfce3edb13f4ac0612d80 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Thu, 23 Jan 2020 15:56:01 +0300 Subject: [PATCH 1/2] Add TotalCommentsCounter to CommentsContainer --- osu.Game/Overlays/Comments/CommentsContainer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs index 9f1d9d9488..433af5fb4e 100644 --- a/osu.Game/Overlays/Comments/CommentsContainer.cs +++ b/osu.Game/Overlays/Comments/CommentsContainer.cs @@ -38,6 +38,7 @@ namespace osu.Game.Overlays.Comments private readonly FillFlowContainer content; private readonly DeletedChildrenPlaceholder deletedChildrenPlaceholder; private readonly CommentsShowMoreButton moreButton; + private readonly TotalCommentsCounter commentCounter; public CommentsContainer() { @@ -56,6 +57,7 @@ namespace osu.Game.Overlays.Comments Direction = FillDirection.Vertical, Children = new Drawable[] { + commentCounter = new TotalCommentsCounter(), new CommentsHeader { Sort = { BindTarget = Sort }, @@ -133,6 +135,7 @@ namespace osu.Game.Overlays.Comments if (!IsLoaded) return; + commentCounter.Current.Value = 0; refetchComments(); } @@ -199,6 +202,8 @@ namespace osu.Game.Overlays.Comments moreButton.IsLoading = false; } + commentCounter.Current.Value = response.Total; + moreButton.FadeTo(response.HasMore ? 1 : 0); }, loadCancellation.Token); } From 5863576ce49721bb0cad638dfdeedb997c95fa48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jan 2020 11:42:33 +0900 Subject: [PATCH 2/2] Add comment as to why counter is zeroes only in Show method --- osu.Game/Overlays/Comments/CommentsContainer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs index 433af5fb4e..d252083411 100644 --- a/osu.Game/Overlays/Comments/CommentsContainer.cs +++ b/osu.Game/Overlays/Comments/CommentsContainer.cs @@ -135,7 +135,9 @@ namespace osu.Game.Overlays.Comments if (!IsLoaded) return; + // only reset when changing ID/type. other refetch ops are generally just changing sort order. commentCounter.Current.Value = 0; + refetchComments(); }