mirror of
https://github.com/ppy/osu
synced 2024-12-17 04:15:37 +00:00
Added user RulesetsStatistics fetching when connecting
This commit is contained in:
parent
caa29e1f9e
commit
e2cdc66f6d
@ -171,12 +171,32 @@ namespace osu.Game.Online.API
|
||||
};
|
||||
userReq.Success += u =>
|
||||
{
|
||||
localUser.Value = u;
|
||||
|
||||
// todo: save/pull from settings
|
||||
localUser.Value.Status.Value = new UserStatusOnline();
|
||||
u.Status.Value = new UserStatusOnline();
|
||||
|
||||
failureCount = 0;
|
||||
|
||||
// getting user's full statistics (concerning every ruleset)
|
||||
// we delay the localUser.Value setting because BindValueChanged won't record two value changes in a row
|
||||
var statsRequest = new GetUsersRequest(new int[] { u.Id });
|
||||
statsRequest.Failure += _ =>
|
||||
{
|
||||
localUser.Value = u;
|
||||
failConnectionProcess();
|
||||
};
|
||||
statsRequest.Success += result =>
|
||||
{
|
||||
if (result.Users.Count == 1)
|
||||
{
|
||||
u.RulesetsStatistics = result.Users[0].RulesetsStatistics;
|
||||
localUser.Value = u;
|
||||
return;
|
||||
}
|
||||
// Should never... happen ?
|
||||
statsRequest.Fail(new Exception("Empty response for GetUsersRequest"));
|
||||
};
|
||||
|
||||
handleRequest(statsRequest);
|
||||
};
|
||||
|
||||
if (!handleRequest(userReq))
|
||||
|
Loading…
Reference in New Issue
Block a user