mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 06:22:56 +08:00
Rename fields from State
to Presence
when presence is involved
This commit is contained in:
parent
a51938f4e9
commit
3bb4b0c2b8
@ -46,7 +46,7 @@ namespace osu.Game.Online
|
||||
private readonly Bindable<bool> notifyOnFriendPresenceChange = new BindableBool();
|
||||
|
||||
private readonly IBindableList<APIRelation> friends = new BindableList<APIRelation>();
|
||||
private readonly IBindableDictionary<int, UserPresence> friendStates = new BindableDictionary<int, UserPresence>();
|
||||
private readonly IBindableDictionary<int, UserPresence> friendPresences = new BindableDictionary<int, UserPresence>();
|
||||
|
||||
private readonly HashSet<APIUser> onlineAlertQueue = new HashSet<APIUser>();
|
||||
private readonly HashSet<APIUser> offlineAlertQueue = new HashSet<APIUser>();
|
||||
@ -63,8 +63,8 @@ namespace osu.Game.Online
|
||||
friends.BindTo(api.Friends);
|
||||
friends.BindCollectionChanged(onFriendsChanged, true);
|
||||
|
||||
friendStates.BindTo(metadataClient.FriendStates);
|
||||
friendStates.BindCollectionChanged(onFriendStatesChanged, true);
|
||||
friendPresences.BindTo(metadataClient.FriendPresences);
|
||||
friendPresences.BindCollectionChanged(onFriendPresenceChanged, true);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -85,7 +85,7 @@ namespace osu.Game.Online
|
||||
if (friend.TargetUser is not APIUser user)
|
||||
continue;
|
||||
|
||||
if (friendStates.TryGetValue(friend.TargetID, out _))
|
||||
if (friendPresences.TryGetValue(friend.TargetID, out _))
|
||||
markUserOnline(user);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ namespace osu.Game.Online
|
||||
}
|
||||
}
|
||||
|
||||
private void onFriendStatesChanged(object? sender, NotifyDictionaryChangedEventArgs<int, UserPresence> e)
|
||||
private void onFriendPresenceChanged(object? sender, NotifyDictionaryChangedEventArgs<int, UserPresence> e)
|
||||
{
|
||||
switch (e.Action)
|
||||
{
|
||||
|
@ -40,17 +40,17 @@ namespace osu.Game.Online.Metadata
|
||||
/// <summary>
|
||||
/// The <see cref="UserPresence"/> information about the current user.
|
||||
/// </summary>
|
||||
public abstract UserPresence LocalUserState { get; }
|
||||
public abstract UserPresence LocalUserPresence { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary keyed by user ID containing all of the <see cref="UserPresence"/> information about currently online users received from the server.
|
||||
/// </summary>
|
||||
public abstract IBindableDictionary<int, UserPresence> UserStates { get; }
|
||||
public abstract IBindableDictionary<int, UserPresence> UserPresences { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary keyed by user ID containing all of the <see cref="UserPresence"/> information about currently online friends received from the server.
|
||||
/// </summary>
|
||||
public abstract IBindableDictionary<int, UserPresence> FriendStates { get; }
|
||||
public abstract IBindableDictionary<int, UserPresence> FriendPresences { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public abstract Task UpdateActivity(UserActivity? activity);
|
||||
|
@ -23,14 +23,14 @@ namespace osu.Game.Online.Metadata
|
||||
public override IBindable<bool> IsWatchingUserPresence => isWatchingUserPresence;
|
||||
private readonly BindableBool isWatchingUserPresence = new BindableBool();
|
||||
|
||||
public override UserPresence LocalUserState => localUserState;
|
||||
private UserPresence localUserState;
|
||||
public override UserPresence LocalUserPresence => localUserPresence;
|
||||
private UserPresence localUserPresence;
|
||||
|
||||
public override IBindableDictionary<int, UserPresence> UserStates => userStates;
|
||||
private readonly BindableDictionary<int, UserPresence> userStates = new BindableDictionary<int, UserPresence>();
|
||||
public override IBindableDictionary<int, UserPresence> UserPresences => userPresences;
|
||||
private readonly BindableDictionary<int, UserPresence> userPresences = new BindableDictionary<int, UserPresence>();
|
||||
|
||||
public override IBindableDictionary<int, UserPresence> FriendStates => friendStates;
|
||||
private readonly BindableDictionary<int, UserPresence> friendStates = new BindableDictionary<int, UserPresence>();
|
||||
public override IBindableDictionary<int, UserPresence> FriendPresences => friendPresences;
|
||||
private readonly BindableDictionary<int, UserPresence> friendPresences = new BindableDictionary<int, UserPresence>();
|
||||
|
||||
public override IBindable<DailyChallengeInfo?> DailyChallengeInfo => dailyChallengeInfo;
|
||||
private readonly Bindable<DailyChallengeInfo?> dailyChallengeInfo = new Bindable<DailyChallengeInfo?>();
|
||||
@ -110,10 +110,10 @@ namespace osu.Game.Online.Metadata
|
||||
Schedule(() =>
|
||||
{
|
||||
isWatchingUserPresence.Value = false;
|
||||
userStates.Clear();
|
||||
friendStates.Clear();
|
||||
userPresences.Clear();
|
||||
friendPresences.Clear();
|
||||
dailyChallengeInfo.Value = null;
|
||||
localUserState = default;
|
||||
localUserPresence = default;
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -208,16 +208,16 @@ namespace osu.Game.Online.Metadata
|
||||
if (presence?.Status != null)
|
||||
{
|
||||
if (userId == api.LocalUser.Value.OnlineID)
|
||||
localUserState = presence.Value;
|
||||
localUserPresence = presence.Value;
|
||||
else
|
||||
userStates[userId] = presence.Value;
|
||||
userPresences[userId] = presence.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (userId == api.LocalUser.Value.OnlineID)
|
||||
localUserState = default;
|
||||
localUserPresence = default;
|
||||
else
|
||||
userStates.Remove(userId);
|
||||
userPresences.Remove(userId);
|
||||
}
|
||||
});
|
||||
|
||||
@ -229,9 +229,9 @@ namespace osu.Game.Online.Metadata
|
||||
Schedule(() =>
|
||||
{
|
||||
if (presence?.Status != null)
|
||||
friendStates[userId] = presence.Value;
|
||||
friendPresences[userId] = presence.Value;
|
||||
else
|
||||
friendStates.Remove(userId);
|
||||
friendPresences.Remove(userId);
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
@ -256,7 +256,7 @@ namespace osu.Game.Online.Metadata
|
||||
throw new OperationCanceledException();
|
||||
|
||||
// must be scheduled before any remote calls to avoid mis-ordering.
|
||||
Schedule(() => userStates.Clear());
|
||||
Schedule(() => userPresences.Clear());
|
||||
Debug.Assert(connection != null);
|
||||
await connection.InvokeAsync(nameof(IMetadataServer.EndWatchingUserPresence)).ConfigureAwait(false);
|
||||
Logger.Log($@"{nameof(OnlineMetadataClient)} stopped watching user presence", LoggingTarget.Network);
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Overlays.Dashboard
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
onlineUsers.BindTo(metadataClient.UserStates);
|
||||
onlineUsers.BindTo(metadataClient.UserPresences);
|
||||
onlineUsers.BindCollectionChanged(onUserUpdated, true);
|
||||
|
||||
playingUsers.BindTo(spectatorClient.PlayingUsers);
|
||||
|
@ -19,14 +19,14 @@ namespace osu.Game.Tests.Visual.Metadata
|
||||
public override IBindable<bool> IsWatchingUserPresence => isWatchingUserPresence;
|
||||
private readonly BindableBool isWatchingUserPresence = new BindableBool();
|
||||
|
||||
public override UserPresence LocalUserState => localUserState;
|
||||
private UserPresence localUserState;
|
||||
public override UserPresence LocalUserPresence => localUserPresence;
|
||||
private UserPresence localUserPresence;
|
||||
|
||||
public override IBindableDictionary<int, UserPresence> UserStates => userStates;
|
||||
private readonly BindableDictionary<int, UserPresence> userStates = new BindableDictionary<int, UserPresence>();
|
||||
public override IBindableDictionary<int, UserPresence> UserPresences => userPresences;
|
||||
private readonly BindableDictionary<int, UserPresence> userPresences = new BindableDictionary<int, UserPresence>();
|
||||
|
||||
public override IBindableDictionary<int, UserPresence> FriendStates => friendStates;
|
||||
private readonly BindableDictionary<int, UserPresence> friendStates = new BindableDictionary<int, UserPresence>();
|
||||
public override IBindableDictionary<int, UserPresence> FriendPresences => friendPresences;
|
||||
private readonly BindableDictionary<int, UserPresence> friendPresences = new BindableDictionary<int, UserPresence>();
|
||||
|
||||
public override Bindable<DailyChallengeInfo?> DailyChallengeInfo => dailyChallengeInfo;
|
||||
private readonly Bindable<DailyChallengeInfo?> dailyChallengeInfo = new Bindable<DailyChallengeInfo?>();
|
||||
@ -50,9 +50,9 @@ namespace osu.Game.Tests.Visual.Metadata
|
||||
{
|
||||
if (isWatchingUserPresence.Value)
|
||||
{
|
||||
userStates.TryGetValue(api.LocalUser.Value.Id, out var localUserPresence);
|
||||
userPresences.TryGetValue(api.LocalUser.Value.Id, out var localUserPresence);
|
||||
localUserPresence = localUserPresence with { Activity = activity };
|
||||
userStates[api.LocalUser.Value.Id] = localUserPresence;
|
||||
userPresences[api.LocalUser.Value.Id] = localUserPresence;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
@ -62,9 +62,9 @@ namespace osu.Game.Tests.Visual.Metadata
|
||||
{
|
||||
if (isWatchingUserPresence.Value)
|
||||
{
|
||||
userStates.TryGetValue(api.LocalUser.Value.Id, out var localUserPresence);
|
||||
userPresences.TryGetValue(api.LocalUser.Value.Id, out var localUserPresence);
|
||||
localUserPresence = localUserPresence with { Status = status };
|
||||
userStates[api.LocalUser.Value.Id] = localUserPresence;
|
||||
userPresences[api.LocalUser.Value.Id] = localUserPresence;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
@ -77,16 +77,16 @@ namespace osu.Game.Tests.Visual.Metadata
|
||||
if (presence?.Status != null)
|
||||
{
|
||||
if (userId == api.LocalUser.Value.OnlineID)
|
||||
localUserState = presence.Value;
|
||||
localUserPresence = presence.Value;
|
||||
else
|
||||
userStates[userId] = presence.Value;
|
||||
userPresences[userId] = presence.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (userId == api.LocalUser.Value.OnlineID)
|
||||
localUserState = default;
|
||||
localUserPresence = default;
|
||||
else
|
||||
userStates.Remove(userId);
|
||||
userPresences.Remove(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,9 +96,9 @@ namespace osu.Game.Tests.Visual.Metadata
|
||||
public override Task FriendPresenceUpdated(int userId, UserPresence? presence)
|
||||
{
|
||||
if (presence.HasValue)
|
||||
friendStates[userId] = presence.Value;
|
||||
friendPresences[userId] = presence.Value;
|
||||
else
|
||||
friendStates.Remove(userId);
|
||||
friendPresences.Remove(userId);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user