mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 10:47:22 +09:00
Chat message notifications always play on unfocused window
This commit is contained in:
parent
dc421bd2af
commit
7ac6688a0f
@ -12,6 +12,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -35,6 +36,9 @@ namespace osu.Game.Online.Chat
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private ChannelManager channelManager { get; set; }
|
private ChannelManager channelManager { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
private Bindable<bool> notifyOnUsername;
|
private Bindable<bool> notifyOnUsername;
|
||||||
private Bindable<bool> notifyOnPrivateMessage;
|
private Bindable<bool> notifyOnPrivateMessage;
|
||||||
|
|
||||||
@ -89,8 +93,8 @@ namespace osu.Game.Online.Chat
|
|||||||
if (channel == null)
|
if (channel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Only send notifications, if ChatOverlay and the target channel aren't visible.
|
// Only send notifications, if ChatOverlay and the target channel aren't visible, or if the window is unfocused
|
||||||
if (chatOverlay.IsPresent && channelManager.CurrentChannel.Value == channel)
|
if (chatOverlay.IsPresent && channelManager.CurrentChannel.Value == channel && host.IsActive.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var message in messages.OrderByDescending(m => m.Id))
|
foreach (var message in messages.OrderByDescending(m => m.Id))
|
||||||
@ -99,6 +103,7 @@ namespace osu.Game.Online.Chat
|
|||||||
if (message.Id <= channel.LastReadId)
|
if (message.Id <= channel.LastReadId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// ignore notifications triggered by your own chat messages
|
||||||
if (message.Sender.Id == localUser.Value.Id)
|
if (message.Sender.Id == localUser.Value.Id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user