mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 21:02:59 +08:00
Merge pull request #31663 from nekodex/friend-notification-samples
Add unique samples for friend online/offline notifications
This commit is contained in:
commit
8a887abe51
@ -31,15 +31,6 @@ namespace osu.Game.Online
|
||||
[Resolved]
|
||||
private MetadataClient metadataClient { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private ChannelManager channelManager { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private ChatOverlay chatOverlay { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; } = null!;
|
||||
|
||||
@ -165,26 +156,7 @@ namespace osu.Game.Online
|
||||
return;
|
||||
}
|
||||
|
||||
APIUser? singleUser = onlineAlertQueue.Count == 1 ? onlineAlertQueue.Single() : null;
|
||||
|
||||
notifications.Post(new SimpleNotification
|
||||
{
|
||||
Transient = true,
|
||||
IsImportant = false,
|
||||
Icon = FontAwesome.Solid.User,
|
||||
Text = $"Online: {string.Join(@", ", onlineAlertQueue.Select(u => u.Username))}",
|
||||
IconColour = colours.GrayD,
|
||||
Activated = () =>
|
||||
{
|
||||
if (singleUser != null)
|
||||
{
|
||||
channelManager.OpenPrivateChannel(singleUser);
|
||||
chatOverlay.Show();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
notifications.Post(new FriendOnlineNotification(onlineAlertQueue.ToArray()));
|
||||
|
||||
onlineAlertQueue.Clear();
|
||||
lastOnlineAlertTime = null;
|
||||
@ -204,17 +176,60 @@ namespace osu.Game.Online
|
||||
return;
|
||||
}
|
||||
|
||||
notifications.Post(new SimpleNotification
|
||||
{
|
||||
Transient = true,
|
||||
IsImportant = false,
|
||||
Icon = FontAwesome.Solid.UserSlash,
|
||||
Text = $"Offline: {string.Join(@", ", offlineAlertQueue.Select(u => u.Username))}",
|
||||
IconColour = colours.Gray3
|
||||
});
|
||||
notifications.Post(new FriendOfflineNotification(offlineAlertQueue.ToArray()));
|
||||
|
||||
offlineAlertQueue.Clear();
|
||||
lastOfflineAlertTime = null;
|
||||
}
|
||||
|
||||
public partial class FriendOnlineNotification : SimpleNotification
|
||||
{
|
||||
private readonly ICollection<APIUser> users;
|
||||
|
||||
public FriendOnlineNotification(ICollection<APIUser> users)
|
||||
{
|
||||
this.users = users;
|
||||
Transient = true;
|
||||
IsImportant = false;
|
||||
Icon = FontAwesome.Solid.User;
|
||||
Text = $"Online: {string.Join(@", ", users.Select(u => u.Username))}";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, ChannelManager channelManager, ChatOverlay chatOverlay)
|
||||
{
|
||||
IconColour = colours.GrayD;
|
||||
Activated = () =>
|
||||
{
|
||||
APIUser? singleUser = users.Count == 1 ? users.Single() : null;
|
||||
|
||||
if (singleUser != null)
|
||||
{
|
||||
channelManager.OpenPrivateChannel(singleUser);
|
||||
chatOverlay.Show();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public override string PopInSampleName => "UI/notification-friend-online";
|
||||
}
|
||||
|
||||
private partial class FriendOfflineNotification : SimpleNotification
|
||||
{
|
||||
public FriendOfflineNotification(ICollection<APIUser> users)
|
||||
{
|
||||
Transient = true;
|
||||
IsImportant = false;
|
||||
Icon = FontAwesome.Solid.UserSlash;
|
||||
Text = $"Offline: {string.Join(@", ", users.Select(u => u.Username))}";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours) => IconColour = colours.Gray3;
|
||||
|
||||
public override string PopInSampleName => "UI/notification-friend-offline";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="20.1.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2025.129.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.1224.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2025.129.0" />
|
||||
<PackageReference Include="Sentry" Version="5.0.0" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user