mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:43:20 +08:00
Changed the text updates into a scheduled (async) operation, and implemented this in the updateStatistics and clearStats methods
This commit is contained in:
parent
103bf1ddc9
commit
a60e53c382
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -187,9 +188,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
ratingsContainer.FadeIn(transition_duration);
|
ratingsContainer.FadeIn(transition_duration);
|
||||||
advanced.Beatmap = Beatmap;
|
advanced.Beatmap = Beatmap;
|
||||||
description.Text = Beatmap.Version;
|
loadDetailsAsync(Beatmap);
|
||||||
source.Text = Beatmap.Metadata.Source;
|
|
||||||
tags.Text = Beatmap.Metadata.Tags;
|
|
||||||
|
|
||||||
var requestedBeatmap = Beatmap;
|
var requestedBeatmap = Beatmap;
|
||||||
if (requestedBeatmap.Metrics == null)
|
if (requestedBeatmap.Metrics == null)
|
||||||
@ -213,6 +212,19 @@ namespace osu.Game.Screens.Select
|
|||||||
displayMetrics(requestedBeatmap.Metrics, false);
|
displayMetrics(requestedBeatmap.Metrics, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadDetailsAsync(BeatmapInfo beatmap)
|
||||||
|
{
|
||||||
|
if (description == null || source == null || tags == null)
|
||||||
|
throw new InvalidOperationException($@"Requires all {nameof(MetadataSection)} elements to be non-null.");
|
||||||
|
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
description.Text = Beatmap?.Version;
|
||||||
|
source.Text = Beatmap?.Metadata?.Source;
|
||||||
|
tags.Text = Beatmap?.Metadata?.Tags;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true)
|
private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true)
|
||||||
{
|
{
|
||||||
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
||||||
@ -258,9 +270,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void clearStats()
|
private void clearStats()
|
||||||
{
|
{
|
||||||
description.Text = null;
|
loadDetailsAsync(null);
|
||||||
source.Text = null;
|
|
||||||
tags.Text = null;
|
|
||||||
advanced.Beatmap = new BeatmapInfo
|
advanced.Beatmap = new BeatmapInfo
|
||||||
{
|
{
|
||||||
StarDifficulty = 0,
|
StarDifficulty = 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user