1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-14 07:32:36 +08:00

Compare commits

...

1 Commits

2 changed files with 9 additions and 10 deletions
+9 -7
View File
@@ -142,10 +142,10 @@ namespace osu.Game.Online.API
// Show a placeholder user if saved credentials are available.
// This is useful for storing local scores and showing a placeholder username after starting the game,
// until a valid connection has been established.
localUser.Value = new APIUser
setLocalUser(new APIUser
{
Username = ProvidedUsername,
};
});
}
// save the username at this point, if the user requested for it to be.
@@ -188,12 +188,12 @@ namespace osu.Game.Online.API
else
failConnectionProcess();
};
userReq.Success += u =>
userReq.Success += user =>
{
localUser.Value = u;
// todo: save/pull from settings
localUser.Value.Status.Value = new UserStatusOnline();
user.Status.Value = new UserStatusOnline();
setLocalUser(user);
failureCount = 0;
};
@@ -453,7 +453,7 @@ namespace osu.Game.Online.API
// Scheduled prior to state change such that the state changed event is invoked with the correct user and their friends present
Schedule(() =>
{
localUser.Value = createGuestUser();
setLocalUser(createGuestUser());
friends.Clear();
});
@@ -463,6 +463,8 @@ namespace osu.Game.Online.API
private static APIUser createGuestUser() => new GuestUser();
private void setLocalUser(APIUser user) => Scheduler.Add(() => localUser.Value = user, false);
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
-3
View File
@@ -13,19 +13,16 @@ namespace osu.Game.Online.API
{
/// <summary>
/// The local user.
/// This is not thread-safe and should be scheduled locally if consumed from a drawable component.
/// </summary>
IBindable<APIUser> LocalUser { get; }
/// <summary>
/// The user's friends.
/// This is not thread-safe and should be scheduled locally if consumed from a drawable component.
/// </summary>
IBindableList<APIUser> Friends { get; }
/// <summary>
/// The current user's activity.
/// This is not thread-safe and should be scheduled locally if consumed from a drawable component.
/// </summary>
IBindable<UserActivity> Activity { get; }