mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 10:27:26 +09:00
Fix wrong handling of missing ruleset statistics
This commit is contained in:
parent
3c26016b61
commit
6c4ca387e0
@ -31,7 +31,7 @@ namespace osu.Game.Online.Solo
|
|||||||
private readonly Dictionary<long, StatisticsUpdateCallback> callbacks = new Dictionary<long, StatisticsUpdateCallback>();
|
private readonly Dictionary<long, StatisticsUpdateCallback> callbacks = new Dictionary<long, StatisticsUpdateCallback>();
|
||||||
private long? lastProcessedScoreId;
|
private long? lastProcessedScoreId;
|
||||||
|
|
||||||
private readonly Dictionary<string, UserStatistics> latestStatistics = new Dictionary<string, UserStatistics>();
|
private Dictionary<string, UserStatistics>? latestStatistics;
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ namespace osu.Game.Online.Solo
|
|||||||
{
|
{
|
||||||
callbacks.Clear();
|
callbacks.Clear();
|
||||||
lastProcessedScoreId = null;
|
lastProcessedScoreId = null;
|
||||||
latestStatistics.Clear();
|
latestStatistics = null;
|
||||||
|
|
||||||
if (localUser == null || localUser.OnlineID <= 1)
|
if (localUser == null || localUser.OnlineID <= 1)
|
||||||
return;
|
return;
|
||||||
@ -77,7 +77,7 @@ namespace osu.Game.Online.Solo
|
|||||||
var userRequest = new GetUsersRequest(new[] { localUser.OnlineID });
|
var userRequest = new GetUsersRequest(new[] { localUser.OnlineID });
|
||||||
userRequest.Success += response => Schedule(() =>
|
userRequest.Success += response => Schedule(() =>
|
||||||
{
|
{
|
||||||
latestStatistics.Clear();
|
latestStatistics = new Dictionary<string, UserStatistics>();
|
||||||
foreach (var rulesetStats in response.Users.Single().RulesetsStatistics)
|
foreach (var rulesetStats in response.Users.Single().RulesetsStatistics)
|
||||||
latestStatistics.Add(rulesetStats.Key, rulesetStats.Value);
|
latestStatistics.Add(rulesetStats.Key, rulesetStats.Value);
|
||||||
});
|
});
|
||||||
@ -109,9 +109,12 @@ namespace osu.Game.Online.Solo
|
|||||||
{
|
{
|
||||||
string rulesetName = callback.Score.Ruleset.ShortName;
|
string rulesetName = callback.Score.Ruleset.ShortName;
|
||||||
|
|
||||||
if (!latestStatistics.TryGetValue(rulesetName, out var latestRulesetStatistics))
|
if (latestStatistics == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
latestStatistics.TryGetValue(rulesetName, out UserStatistics? latestRulesetStatistics);
|
||||||
|
latestRulesetStatistics ??= new UserStatistics();
|
||||||
|
|
||||||
var update = new SoloStatisticsUpdate(callback.Score, latestRulesetStatistics, updatedStatistics);
|
var update = new SoloStatisticsUpdate(callback.Score, latestRulesetStatistics, updatedStatistics);
|
||||||
callback.OnUpdateReady.Invoke(update);
|
callback.OnUpdateReady.Invoke(update);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user