From 94d2799b906a80f7131623f8478bd01dc60aba4b Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Fri, 3 Feb 2023 00:47:10 -0800 Subject: [PATCH 1/4] Fix comments having too much padding at the bottom --- osu.Game/Overlays/Comments/DrawableComment.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 4cc189f3a2..52a207afcd 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -76,6 +76,7 @@ namespace osu.Game.Overlays.Comments private GridContainer content = null!; private VotePill votePill = null!; private Container replyEditorContainer = null!; + private Container repliesButtonContainer = null!; [Resolved] private IDialogOverlay? dialogOverlay { get; set; } @@ -239,10 +240,12 @@ namespace osu.Game.Overlays.Comments AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Padding = new MarginPadding { Top = 10 }, + Alpha = 0, }, - new Container + repliesButtonContainer = new Container { AutoSizeAxes = Axes.Both, + Alpha = 0, Children = new Drawable[] { showRepliesButton = new ShowRepliesButton(Comment.RepliesCount) @@ -449,6 +452,7 @@ namespace osu.Game.Overlays.Comments { if (replyEditorContainer.Count == 0) { + replyEditorContainer.Show(); replyEditorContainer.Add(new ReplyCommentEditor(Comment) { OnPost = comments => @@ -462,6 +466,7 @@ namespace osu.Game.Overlays.Comments else { replyEditorContainer.Clear(true); + replyEditorContainer.Hide(); } } @@ -513,9 +518,11 @@ namespace osu.Game.Overlays.Comments int loadedRepliesCount = loadedReplies.Count; bool hasUnloadedReplies = loadedRepliesCount != Comment.RepliesCount; - loadRepliesButton.FadeTo(hasUnloadedReplies && loadedRepliesCount == 0 ? 1 : 0); - showMoreButton.FadeTo(hasUnloadedReplies && loadedRepliesCount > 0 ? 1 : 0); showRepliesButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0); + loadRepliesButton.FadeTo(hasUnloadedReplies && loadedRepliesCount == 0 ? 1 : 0); + repliesButtonContainer.FadeTo(showRepliesButton.IsPresent || loadRepliesButton.IsPresent ? 1 : 0); + + showMoreButton.FadeTo(hasUnloadedReplies && loadedRepliesCount > 0 ? 1 : 0); if (Comment.IsTopLevel) chevronButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0); From 461b5c537571d29f1046215030a43fe1907c9705 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Fri, 3 Feb 2023 00:48:32 -0800 Subject: [PATCH 2/4] Fix comment cancel button not behaving the same as reply text toggle - Removed the fading animation as it is awkward right now (needs resizing) --- osu.Game/Overlays/Comments/DrawableComment.cs | 3 ++- osu.Game/Overlays/Comments/ReplyCommentEditor.cs | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 52a207afcd..869ed61a9c 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -460,7 +460,8 @@ namespace osu.Game.Overlays.Comments Comment.RepliesCount += comments.Length; showRepliesButton.Count = Comment.RepliesCount; Replies.AddRange(comments); - } + }, + OnCancel = toggleReply }); } else diff --git a/osu.Game/Overlays/Comments/ReplyCommentEditor.cs b/osu.Game/Overlays/Comments/ReplyCommentEditor.cs index e738e6e7ec..8aca183dee 100644 --- a/osu.Game/Overlays/Comments/ReplyCommentEditor.cs +++ b/osu.Game/Overlays/Comments/ReplyCommentEditor.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Game.Online.API; @@ -33,7 +32,6 @@ namespace osu.Game.Overlays.Comments public ReplyCommentEditor(Comment parent) { parentComment = parent; - OnCancel = () => this.FadeOut(200).Expire(); } protected override void LoadComplete() From cb8458cceb6e79ad4fc6920d580e4168df607000 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sat, 4 Feb 2023 20:11:29 -0800 Subject: [PATCH 3/4] Use linq and alpha instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Game/Overlays/Comments/DrawableComment.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 869ed61a9c..c9eb80f676 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -521,7 +521,7 @@ namespace osu.Game.Overlays.Comments showRepliesButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0); loadRepliesButton.FadeTo(hasUnloadedReplies && loadedRepliesCount == 0 ? 1 : 0); - repliesButtonContainer.FadeTo(showRepliesButton.IsPresent || loadRepliesButton.IsPresent ? 1 : 0); + repliesButtonContainer.FadeTo(repliesButtonContainer.Any(child => child.Alpha > 0) ? 1 : 0); showMoreButton.FadeTo(hasUnloadedReplies && loadedRepliesCount > 0 ? 1 : 0); From 277f71d36a2609386453a1b2aae38189f4e8f7ec Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 7 Feb 2023 15:15:51 -0800 Subject: [PATCH 4/4] Expire reply editor instead of clearing container --- osu.Game/Overlays/Comments/DrawableComment.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index c9eb80f676..397dd46cdc 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -466,7 +466,7 @@ namespace osu.Game.Overlays.Comments } else { - replyEditorContainer.Clear(true); + replyEditorContainer.ForEach(e => e.Expire()); replyEditorContainer.Hide(); } }