mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Enable NRT in user profile overlay
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -21,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
private const int ranked_days = 88;
|
||||
|
||||
public readonly Bindable<UserStatistics> Statistics = new Bindable<UserStatistics>();
|
||||
public readonly Bindable<UserStatistics?> Statistics = new Bindable<UserStatistics?>();
|
||||
|
||||
private readonly OsuSpriteText placeholder;
|
||||
|
||||
@ -42,11 +40,11 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
Statistics.BindValueChanged(statistics => updateStatistics(statistics.NewValue), true);
|
||||
}
|
||||
|
||||
private void updateStatistics(UserStatistics statistics)
|
||||
private void updateStatistics(UserStatistics? statistics)
|
||||
{
|
||||
// checking both IsRanked and RankHistory is required.
|
||||
// see https://github.com/ppy/osu-web/blob/154ceafba0f35a1dd935df53ec98ae2ea5615f9f/resources/assets/lib/profile-page/rank-chart.tsx#L46
|
||||
int[] userRanks = statistics?.IsRanked == true ? statistics.RankHistory?.Data : null;
|
||||
int[]? userRanks = statistics?.IsRanked == true ? statistics.RankHistory?.Data : null;
|
||||
Data = userRanks?.Select((x, index) => new KeyValuePair<int, int>(index, x)).Where(x => x.Value != 0).ToArray();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user