private void updateStats() { if (beatmap == null) { return; } description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; tags.Text = beatmap.Metadata.Tags; circleSize.Value = beatmap.Difficulty.CircleSize; drainRate.Value = beatmap.Difficulty.DrainRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; var requestedBeatmap = beatmap; if (requestedBeatmap.Metrics == null) { var lookup = new GetBeatmapDetailsRequest(requestedBeatmap); lookup.Success += res => { if (beatmap != requestedBeatmap) { //the beatmap has been changed since we started the lookup. return; } requestedBeatmap.Metrics = res; Schedule(() => updateMetrics(res)); }; lookup.Failure += e => updateMetrics(null); api.Queue(lookup); loading.Show(); } updateMetrics(requestedBeatmap.Metrics, false); }
private void updateStatistics() { if (Beatmap == null) { clearStats(); return; } ratingsContainer.FadeIn(transition_duration); advanced.Beatmap = Beatmap; description.Text = Beatmap.Version; source.Text = Beatmap.Metadata.Source; tags.Text = Beatmap.Metadata.Tags; var requestedBeatmap = Beatmap; if (requestedBeatmap.Metrics == null) { var lookup = new GetBeatmapDetailsRequest(requestedBeatmap); lookup.Success += res => { if (beatmap != requestedBeatmap) { //the beatmap has been changed since we started the lookup. return; } requestedBeatmap.Metrics = res; Schedule(() => displayMetrics(res)); }; lookup.Failure += e => Schedule(() => displayMetrics(null)); api.Queue(lookup); loading.Show(); } displayMetrics(requestedBeatmap.Metrics, false); }