Fetch listing only once; Reenable disabled links as they wont be regenerated

This commit is contained in:
HoutarouOreki 2018-07-24 21:42:25 +02:00
parent 08a291f0d4
commit 43a7b3a825
2 changed files with 31 additions and 13 deletions

View File

@ -171,7 +171,13 @@ namespace osu.Game.Overlays.Changelog
Direction = FillDirection.Vertical,
},
};
clickableText.Action += () => clickableText.IsEnabled = false;
// we may not want double clicks to make it double the work
clickableText.Action += () =>
{
clickableText.IsEnabled = false;
Scheduler.AddDelayed(() => clickableText.IsEnabled = true, 2000);
};
}
public void UpdateChevronTooltips(string previousVersion, string nextVersion)

View File

@ -26,6 +26,7 @@ namespace osu.Game.Overlays
private readonly ChangelogHeader header;
private readonly ChangelogBadges badges;
private readonly ChangelogChart chart;
private readonly ChangelogContent listing;
private readonly ChangelogContent content;
private readonly ScrollContainer scroll;
@ -85,13 +86,15 @@ namespace osu.Game.Overlays
header = new ChangelogHeader(),
badges = new ChangelogBadges(),
chart = new ChangelogChart(),
listing = new ChangelogContent(),
content = new ChangelogContent()
},
},
},
};
header.ListingSelected += FetchAndShowListing;
header.ListingSelected += ShowListing;
badges.Selected += onBuildSelected;
listing.BuildSelected += onBuildSelected;
content.BuildSelected += onBuildSelected;
}
@ -107,7 +110,7 @@ namespace osu.Game.Overlays
var req = new GetChangelogLatestBuildsRequest();
req.Success += badges.Populate;
api.Queue(req);
FetchAndShowListing();
fetchListing();
base.LoadComplete();
}
@ -132,7 +135,7 @@ namespace osu.Game.Overlays
State = Visibility.Hidden;
else
{
FetchAndShowListing();
ShowListing();
sampleBack?.Play();
}
return true;
@ -143,10 +146,7 @@ namespace osu.Game.Overlays
private void onBuildSelected(APIChangelog build, EventArgs e) => FetchAndShowBuild(build);
/// <summary>
/// If we're not already at it, fetches and shows changelog listing.
/// </summary>
public void FetchAndShowListing()
private void fetchListing()
{
header.ShowListing();
if (isAtListing)
@ -155,14 +155,24 @@ namespace osu.Game.Overlays
var req = new GetChangelogRequest();
badges.SelectNone();
chart.ShowAllUpdateStreams();
req.Success += listing =>
{
content.ShowListing(listing);
scroll.ScrollTo(savedScrollPosition);
};
req.Success += listing.ShowListing;
api.Queue(req);
}
public void ShowListing()
{
header.ShowListing();
if (isAtListing)
return;
isAtListing = true;
content.Hide();
listing.Show();
badges.SelectNone();
chart.ShowAllUpdateStreams();
listing.Show();
scroll.ScrollTo(savedScrollPosition);
}
/// <summary>
/// Fetches and shows a specific build from a specific update stream.
/// </summary>
@ -181,6 +191,8 @@ namespace osu.Game.Overlays
chart.ShowUpdateStream(build.UpdateStream.Name);
req.Success += APIChangelog =>
{
listing.Hide();
content.Show();
content.ShowBuild(APIChangelog);
if (scroll.Current > scroll.GetChildPosInContent(content))
scroll.ScrollTo(content);