From 160b988735de65d71a6b5d360bb947dfee8055fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 Nov 2017 18:51:41 +0900 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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 =>