mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Remove highlighted/mentioned words
This commit is contained in:
@ -52,8 +52,6 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.ChatHighlightName, true);
|
Set(OsuSetting.ChatHighlightName, true);
|
||||||
Set(OsuSetting.ChatMessageNotification, true);
|
Set(OsuSetting.ChatMessageNotification, true);
|
||||||
|
|
||||||
Set(OsuSetting.HighlightWords, string.Empty);
|
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
|
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
|
||||||
|
|
||||||
|
@ -141,17 +141,6 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(highlightWords.Value))
|
|
||||||
{
|
|
||||||
var matchedWord = hasCaseInsensitive(words, getWords(highlightWords.Value));
|
|
||||||
|
|
||||||
if (matchedWord != null)
|
|
||||||
{
|
|
||||||
var notification = new HighlightNotification(message.Sender.Username, matchedWord, onClick);
|
|
||||||
notificationOverlay?.Post(notification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,30 +153,7 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
private static bool anyCaseInsensitive(IEnumerable<string> x, string y) => x.Any(x2 => x2.Equals(y, StringComparison.OrdinalIgnoreCase));
|
private static bool anyCaseInsensitive(IEnumerable<string> x, string y) => x.Any(x2 => x2.Equals(y, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
public class HighlightNotification : SimpleNotification
|
|
||||||
{
|
|
||||||
public HighlightNotification(string highlighter, string word, Action onClick)
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.Highlighter;
|
|
||||||
Text = $"'{word}' was mentioned in chat by '{highlighter}'. Click to find out why!";
|
|
||||||
this.onClick = onClick;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Action onClick;
|
|
||||||
|
|
||||||
public override bool IsImportant => false;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
IconBackgound.Colour = colours.PurpleDark;
|
|
||||||
Activated = delegate
|
|
||||||
{
|
|
||||||
onClick?.Invoke();
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PrivateMessageNotification : SimpleNotification
|
public class PrivateMessageNotification : SimpleNotification
|
||||||
{
|
{
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Configuration;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.Online
|
|
||||||
{
|
|
||||||
public class InGameChatSettings : SettingsSubsection
|
|
||||||
{
|
|
||||||
protected override string Header => "In-Game Chat";
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuConfigManager config)
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new SettingsTextBox
|
|
||||||
{
|
|
||||||
LabelText = "Chat highlight words (space-separated list)",
|
|
||||||
Bindable = config.GetBindable<string>(OsuSetting.HighlightWords)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,8 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new WebSettings(),
|
new WebSettings(),
|
||||||
new AlertsAndPrivacySettings(),
|
new AlertsAndPrivacySettings()
|
||||||
new InGameChatSettings()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user