mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 07:32:55 +08:00
API request clean-up
This commit is contained in:
parent
827ca445b1
commit
1505ca976b
@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
public List<APIChangelogEntry> ChangelogEntries { get; set; }
|
public List<APIChangelogEntry> ChangelogEntries { get; set; }
|
||||||
|
|
||||||
[JsonProperty("versions")]
|
[JsonProperty("versions")]
|
||||||
public VersionNativation Versions { get; set; }
|
public VersionNatigation Versions { get; set; }
|
||||||
|
|
||||||
public class VersionNativation
|
public class VersionNatigation
|
||||||
{
|
{
|
||||||
[JsonProperty("next")]
|
[JsonProperty("next")]
|
||||||
public APIChangelogBuild Next { get; set; }
|
public APIChangelogBuild Next { get; set; }
|
||||||
|
@ -157,28 +157,32 @@ namespace osu.Game.Overlays
|
|||||||
/// <see cref="APIChangelogBuild.DisplayVersion"/> are specified, the header will instantly display them.</param>
|
/// <see cref="APIChangelogBuild.DisplayVersion"/> are specified, the header will instantly display them.</param>
|
||||||
public void ShowBuild(APIChangelogBuild build)
|
public void ShowBuild(APIChangelogBuild build)
|
||||||
{
|
{
|
||||||
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
|
header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion);
|
||||||
|
|
||||||
if (build.UpdateStream.DisplayName != null && build.DisplayVersion != null)
|
|
||||||
header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion);
|
|
||||||
else
|
|
||||||
req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion);
|
|
||||||
|
|
||||||
badges.SelectUpdateStream(build.UpdateStream.Name);
|
badges.SelectUpdateStream(build.UpdateStream.Name);
|
||||||
|
|
||||||
req.Success += apiChangelog =>
|
listing.Hide();
|
||||||
|
|
||||||
|
void displayBuild(APIChangelogBuild populatedBuild)
|
||||||
{
|
{
|
||||||
listing.Hide();
|
|
||||||
content.Show();
|
content.Show();
|
||||||
content.ShowBuild(apiChangelog);
|
content.ShowBuild(populatedBuild);
|
||||||
|
|
||||||
if (scroll.Current > scroll.GetChildPosInContent(content))
|
if (scroll.Current > scroll.GetChildPosInContent(content))
|
||||||
scroll.ScrollTo(content);
|
scroll.ScrollTo(content);
|
||||||
|
|
||||||
if (isAtListing)
|
if (isAtListing)
|
||||||
savedScrollPosition = scroll.Current;
|
savedScrollPosition = scroll.Current;
|
||||||
isAtListing = false;
|
isAtListing = false;
|
||||||
};
|
}
|
||||||
|
|
||||||
API.Queue(req);
|
if (build.Versions != null)
|
||||||
|
displayBuild(build);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
|
||||||
|
req.Success += displayBuild;
|
||||||
|
API.Queue(req);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user