1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 16:06:06 +08:00

Prevent duplicated fetching for listing and builds:

- listing when already at it;
- builds by immediately disabling links to them (chevrons and links in listing)
This commit is contained in:
HoutarouOreki 2018-07-24 19:34:40 +02:00
parent 16d3ca2073
commit dfe4153c95
2 changed files with 17 additions and 5 deletions

View File

@ -50,7 +50,11 @@ namespace osu.Game.Overlays.Changelog
IsEnabled = false,
Icon = FontAwesome.fa_chevron_left,
Size = new Vector2(24),
Action = () => OnBuildSelected(build.Versions.Previous),
Action = () =>
{
OnBuildSelected(build.Versions.Previous);
chevronPrevious.IsEnabled = false;
},
},
new FillFlowContainer<SpriteText>
{
@ -83,7 +87,11 @@ namespace osu.Game.Overlays.Changelog
IsEnabled = false,
Icon = FontAwesome.fa_chevron_right,
Size = new Vector2(24),
Action = () => OnBuildSelected(build.Versions.Next),
Action = () =>
{
OnBuildSelected(build.Versions.Next);
chevronNext.IsEnabled = false;
},
},
}
},
@ -110,6 +118,7 @@ namespace osu.Game.Overlays.Changelog
public ChangelogContentGroup(APIChangelog build, bool newDate = false)
{
ClickableText clickableText;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
@ -145,7 +154,7 @@ namespace osu.Game.Overlays.Changelog
TextSize = 20, // web: 18,
Font = @"Exo2.0-Medium",
},
new ClickableText
clickableText = new ClickableText
{
Text = build.DisplayVersion,
TextSize = 20, // web: 18,
@ -162,6 +171,7 @@ namespace osu.Game.Overlays.Changelog
Direction = FillDirection.Vertical,
},
};
clickableText.Action += () => clickableText.IsEnabled = false;
}
public void UpdateChevronTooltips(string previousVersion, string nextVersion)

View File

@ -141,13 +141,15 @@ namespace osu.Game.Overlays
private void onBuildSelected(APIChangelog build, EventArgs e) => FetchAndShowBuild(build);
/// <summary>
/// Fetches and shows changelog listing.
/// If we're not already at it, fetches and shows changelog listing.
/// </summary>
public void FetchAndShowListing()
{
header.ShowListing();
if (isAtListing)
return;
isAtListing = true;
var req = new GetChangelogRequest();
header.ShowListing();
badges.SelectNone();
chart.ShowAllUpdateStreams();
req.Success += content.ShowListing;