mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 22:22:55 +08:00
Extract helper function for pp value handling
This commit is contained in:
parent
d4ba9d2682
commit
68b505ab86
@ -28,19 +28,21 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
|||||||
{
|
{
|
||||||
if (score.PP.HasValue)
|
if (score.PP.HasValue)
|
||||||
{
|
{
|
||||||
performance.Value = (int)Math.Round(score.PP.Value, MidpointRounding.AwayFromZero);
|
setPerformanceValue(score.PP.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
|
performanceManager.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
|
||||||
.ContinueWith(t => Schedule(() =>
|
.ContinueWith(t => Schedule(() => setPerformanceValue(t.Result)), cancellationTokenSource.Token);
|
||||||
{
|
|
||||||
if (t.Result.HasValue)
|
|
||||||
performance.Value = (int)Math.Round(t.Result.Value, MidpointRounding.AwayFromZero);
|
|
||||||
}), cancellationTokenSource.Token);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setPerformanceValue(double? pp)
|
||||||
|
{
|
||||||
|
if (pp.HasValue)
|
||||||
|
performance.Value = (int)Math.Round(pp.Value, MidpointRounding.AwayFromZero);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Appear()
|
public override void Appear()
|
||||||
{
|
{
|
||||||
base.Appear();
|
base.Appear();
|
||||||
|
Loading…
Reference in New Issue
Block a user