diff --git a/Content.Client/Administration/Systems/BwoinkAdminSystem.cs b/Content.Client/Administration/Systems/BwoinkAdminSystem.cs new file mode 100644 index 00000000000000..2979228f670e2d --- /dev/null +++ b/Content.Client/Administration/Systems/BwoinkAdminSystem.cs @@ -0,0 +1,41 @@ +#nullable enable +using Content.Shared.Administration; +using JetBrains.Annotations; +using Robust.Shared.Network; +using Robust.Shared.Timing; + +namespace Content.Client.Administration.Systems; + +[UsedImplicitly] +public sealed class BwoinkAdminSystem : SharedBwoinkAdminSystem +{ + [Dependency] private readonly IGameTiming _timing = default!; + + public event EventHandler? OnBwoinkTextMessageRecieved; + private (TimeSpan Timestamp, bool Typing) _lastTypingUpdateSent; + + protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySessionEventArgs eventArgs) + { + OnBwoinkTextMessageRecieved?.Invoke(this, message); + } + + public void Send(NetUserId channelId, string text, bool playSound) + { + // Reuse the channel ID as the 'true sender'. + // Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help. + RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound)); + SendInputTextUpdated(channelId, false); + } + + public void SendInputTextUpdated(NetUserId channel, bool typing) + { + if (_lastTypingUpdateSent.Typing == typing && + _lastTypingUpdateSent.Timestamp + TimeSpan.FromSeconds(1) > _timing.RealTime) + { + return; + } + + _lastTypingUpdateSent = (_timing.RealTime, typing); + RaiseNetworkEvent(new BwoinkClientTypingUpdated(channel, typing)); + } +} diff --git a/Content.Client/Administration/Systems/BwoinkMentorSystem.cs b/Content.Client/Administration/Systems/BwoinkMentorSystem.cs new file mode 100644 index 00000000000000..879b490f6dcf3f --- /dev/null +++ b/Content.Client/Administration/Systems/BwoinkMentorSystem.cs @@ -0,0 +1,41 @@ +#nullable enable +using Content.Shared.Administration; +using JetBrains.Annotations; +using Robust.Shared.Network; +using Robust.Shared.Timing; + +namespace Content.Client.Administration.Systems; + +[UsedImplicitly] +public sealed class BwoinkMentorSystem : SharedBwoinkAdminSystem +{ + [Dependency] private readonly IGameTiming _timing = default!; + + public event EventHandler? OnBwoinkTextMessageRecieved; + private (TimeSpan Timestamp, bool Typing) _lastTypingUpdateSent; + + protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySessionEventArgs eventArgs) + { + OnBwoinkTextMessageRecieved?.Invoke(this, message); + } + + public void Send(NetUserId channelId, string text, bool playSound) + { + // Reuse the channel ID as the 'true sender'. + // Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help. + RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound)); + SendInputTextUpdated(channelId, false); + } + + public void SendInputTextUpdated(NetUserId channel, bool typing) + { + if (_lastTypingUpdateSent.Typing == typing && + _lastTypingUpdateSent.Timestamp + TimeSpan.FromSeconds(1) > _timing.RealTime) + { + return; + } + + _lastTypingUpdateSent = (_timing.RealTime, typing); + RaiseNetworkEvent(new BwoinkClientTypingUpdated(channel, typing)); + } +} diff --git a/Content.Client/Administration/Systems/BwoinkSystem.cs b/Content.Client/Administration/Systems/BwoinkSystem.cs deleted file mode 100644 index 5166dc8416babe..00000000000000 --- a/Content.Client/Administration/Systems/BwoinkSystem.cs +++ /dev/null @@ -1,42 +0,0 @@ -#nullable enable -using Content.Shared.Administration; -using JetBrains.Annotations; -using Robust.Shared.Network; -using Robust.Shared.Timing; - -namespace Content.Client.Administration.Systems -{ - [UsedImplicitly] - public sealed class BwoinkSystem : SharedBwoinkSystem - { - [Dependency] private readonly IGameTiming _timing = default!; - - public event EventHandler? OnBwoinkTextMessageRecieved; - private (TimeSpan Timestamp, bool Typing) _lastTypingUpdateSent; - - protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySessionEventArgs eventArgs) - { - OnBwoinkTextMessageRecieved?.Invoke(this, message); - } - - public void Send(NetUserId channelId, string text, bool playSound) - { - // Reuse the channel ID as the 'true sender'. - // Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help. - RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound)); - SendInputTextUpdated(channelId, false); - } - - public void SendInputTextUpdated(NetUserId channel, bool typing) - { - if (_lastTypingUpdateSent.Typing == typing && - _lastTypingUpdateSent.Timestamp + TimeSpan.FromSeconds(1) > _timing.RealTime) - { - return; - } - - _lastTypingUpdateSent = (_timing.RealTime, typing); - RaiseNetworkEvent(new BwoinkClientTypingUpdated(channel, typing)); - } - } -} diff --git a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml b/Content.Client/Administration/UI/Bwoink/BwoinkControlAhelp.xaml similarity index 97% rename from Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml rename to Content.Client/Administration/UI/Bwoink/BwoinkControlAhelp.xaml index 39ea50edbef02f..d3c3e29eb86b35 100644 --- a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml +++ b/Content.Client/Administration/UI/Bwoink/BwoinkControlAhelp.xaml @@ -1,4 +1,5 @@ - + diff --git a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs b/Content.Client/Administration/UI/Bwoink/BwoinkControlAhelp.xaml.cs similarity index 99% rename from Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs rename to Content.Client/Administration/UI/Bwoink/BwoinkControlAhelp.xaml.cs index b4e9a07ef88b7a..166c7926fe5bd2 100644 --- a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs +++ b/Content.Client/Administration/UI/Bwoink/BwoinkControlAhelp.xaml.cs @@ -20,7 +20,7 @@ namespace Content.Client.Administration.UI.Bwoink /// This window connects to a BwoinkSystem channel. BwoinkSystem manages the rest. /// [GenerateTypedNameReferences] - public sealed partial class BwoinkControl : Control + public sealed partial class BwoinkControlAhelp : Control { [Dependency] private readonly IClientAdminManager _adminManager = default!; [Dependency] private readonly IClientConsoleHost _console = default!; @@ -31,7 +31,7 @@ public sealed partial class BwoinkControl : Control private PlayerInfo? _currentPlayer; private readonly Dictionary _confirmations = new(); - public BwoinkControl() + public BwoinkControlAhelp() { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); diff --git a/Content.Client/Administration/UI/Bwoink/BwoinkControlMentorhelp.xaml b/Content.Client/Administration/UI/Bwoink/BwoinkControlMentorhelp.xaml new file mode 100644 index 00000000000000..114afcac24f3ce --- /dev/null +++ b/Content.Client/Administration/UI/Bwoink/BwoinkControlMentorhelp.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + +