From 08ce2705c6bc8ba9ad2bdd244b6f5b1e927bcd1a Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 14 Nov 2017 08:26:44 +0300 Subject: [PATCH 1/4] Add pending and graveyarded beatmapsets to profile page --- osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs | 4 +++- .../Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs | 3 +-- osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs | 6 ++++-- osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index 66b2cae892..a66799f404 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -26,6 +26,8 @@ namespace osu.Game.Online.API.Requests { MostPlayed, Favourite, - RankedAndApproved + RankedAndApproved, + Unranked, + Graveyard } } diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 2607585573..0a86b15504 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps private DirectPanel playing; - public PaginatedBeatmapContainer(BeatmapSetType type, Bindable user, string header, string missing) + public PaginatedBeatmapContainer(BeatmapSetType type, Bindable user, string header, string missing = "None... yet.") : base(user, header, missing) { this.type = type; @@ -27,7 +27,6 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps ItemsPerPage = 6; ItemsContainer.Spacing = new Vector2(panel_padding); - ItemsContainer.Margin = new MarginPadding { Bottom = panel_padding }; } protected override void ShowMore() diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index f55de9b83f..3e88795b77 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -16,8 +16,10 @@ namespace osu.Game.Overlays.Profile.Sections { Children = new[] { - new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps", "None... yet."), - new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps", "None... yet."), + new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps"), + new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps"), + new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"), + new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"), }; } } diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index b75d1bc4d6..1d4045c379 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -51,6 +51,7 @@ namespace osu.Game.Overlays.Profile.Sections { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Bottom = 10 } }, ShowMoreButton = new OsuHoverContainer { From 160b988735de65d71a6b5d360bb947dfee8055fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Nov 2017 18:51:41 +0900 Subject: [PATCH 2/4] Reduce number of rqeuests to display beatmaps in profile Comes at the cost of losing some information which should be loaded. This will be fixed at the osu-web end. --- .../Beatmaps/PaginatedBeatmapContainer.cs | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 2607585573..aec345e4d8 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -52,24 +52,18 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps if (!s.OnlineBeatmapSetID.HasValue) continue; - var subReq = new GetBeatmapSetRequest(s.OnlineBeatmapSetID.Value); - subReq.Success += b => + var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets)) { Width = 400 }; + ItemsContainer.Add(panel); + + panel.PreviewPlaying.ValueChanged += newValue => { - var panel = new DirectGridPanel(b.ToBeatmapSet(Rulesets)) { Width = 400 }; - ItemsContainer.Add(panel); - - panel.PreviewPlaying.ValueChanged += newValue => + if (newValue) { - if (newValue) - { - if (playing != null && playing != panel) - playing.PreviewPlaying.Value = false; - playing = panel; - } - }; + if (playing != null && playing != panel) + playing.PreviewPlaying.Value = false; + playing = panel; + } }; - - Api.Queue(subReq); } }; From f96f7e696d73f507ea87ad8b952defe5c79bf4cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Nov 2017 18:53:09 +0900 Subject: [PATCH 3/4] Tidy up variables a bit --- .../Beatmaps/PaginatedBeatmapContainer.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index aec345e4d8..4840341f2f 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps private readonly BeatmapSetType type; - private DirectPanel playing; + private DirectPanel currentlyPlaying; public PaginatedBeatmapContainer(BeatmapSetType type, Bindable user, string header, string missing) : base(user, header, missing) @@ -55,14 +55,14 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets)) { Width = 400 }; ItemsContainer.Add(panel); - panel.PreviewPlaying.ValueChanged += newValue => + panel.PreviewPlaying.ValueChanged += isPlaying => { - if (newValue) - { - if (playing != null && playing != panel) - playing.PreviewPlaying.Value = false; - playing = panel; - } + if (!isPlaying) return; + + if (currentlyPlaying != null && currentlyPlaying != panel) + currentlyPlaying.PreviewPlaying.Value = false; + + currentlyPlaying = panel; }; } }; From 44671ad9cbfaa1d6ca0d81e83f06a9ecb8608b4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Nov 2017 19:03:50 +0900 Subject: [PATCH 4/4] Move common width definition to base class --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 1 + osu.Game/Overlays/DirectOverlay.cs | 2 +- .../Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index e863f78e3f..a40f20850e 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Direct public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap) { + Width = 400; Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image) } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index d11f2342cd..6f7fabb910 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -222,7 +222,7 @@ namespace osu.Game.Overlays switch (displayStyle) { case PanelDisplayStyle.Grid: - return new DirectGridPanel(b) { Width = 400 }; + return new DirectGridPanel(b); default: return new DirectListPanel(b); } diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 4840341f2f..983ef004d0 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps if (!s.OnlineBeatmapSetID.HasValue) continue; - var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets)) { Width = 400 }; + var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets)); ItemsContainer.Add(panel); panel.PreviewPlaying.ValueChanged += isPlaying =>