1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 07:42:55 +08:00

Merge pull request #1504 from peppy/less-beatmap-requests

Reduce number of rqeuests to display beatmaps in profile
This commit is contained in:
Dan Balasescu 2017-11-14 19:14:08 +09:00 committed by GitHub
commit fff53be00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 17 deletions

View File

@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Direct
public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap) 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) Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image)
} }

View File

@ -222,7 +222,7 @@ namespace osu.Game.Overlays
switch (displayStyle) switch (displayStyle)
{ {
case PanelDisplayStyle.Grid: case PanelDisplayStyle.Grid:
return new DirectGridPanel(b) { Width = 400 }; return new DirectGridPanel(b);
default: default:
return new DirectListPanel(b); return new DirectListPanel(b);
} }

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
private readonly BeatmapSetType type; private readonly BeatmapSetType type;
private DirectPanel playing; private DirectPanel currentlyPlaying;
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing) public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing)
: base(user, header, missing) : base(user, header, missing)
@ -52,24 +52,18 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
if (!s.OnlineBeatmapSetID.HasValue) if (!s.OnlineBeatmapSetID.HasValue)
continue; continue;
var subReq = new GetBeatmapSetRequest(s.OnlineBeatmapSetID.Value); var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets));
subReq.Success += b => ItemsContainer.Add(panel);
panel.PreviewPlaying.ValueChanged += isPlaying =>
{ {
var panel = new DirectGridPanel(b.ToBeatmapSet(Rulesets)) { Width = 400 }; if (!isPlaying) return;
ItemsContainer.Add(panel);
panel.PreviewPlaying.ValueChanged += newValue => if (currentlyPlaying != null && currentlyPlaying != panel)
{ currentlyPlaying.PreviewPlaying.Value = false;
if (newValue)
{ currentlyPlaying = panel;
if (playing != null && playing != panel)
playing.PreviewPlaying.Value = false;
playing = panel;
}
};
}; };
Api.Queue(subReq);
} }
}; };