Files
tbd-station-14/Content.Client/Administration/UI/BwoinkWindow.xaml.cs
20kdc b3f43509d1 Basic AHelp Panel, Ported & Fixed (#4776)
* Graft from https://github.com/space-wizards/space-station-14/pull/3049

* 'openahelp' command

* Add AHelp into escape menu

* Add a way to ahelp a player from the kick window

* bwoink: XAMLify, bugfix, etc.

* Rename the kick/bwoink window the Player Actions Panel

* Add the bwoink sound y'all know and love

adminhelp.ogg taken from d775e1ac80/sound/effects/adminhelp.ogg
 (available in master, therefore see master license: "All assets including icons and sound are under a Creative Commons 3.0 BY-SA license unless otherwise indicated.")
 "Changed the adminhelpsound to some creative commons sound I pinched. Until somebody can get a better one. I'm sick of MAAAAAAAAOOOOOOW."
 Actual source is https://freesound.org/people/martian/sounds/19261/ (CC0)
 The sound had been reversed and the volume altered.

* Actually play the bwoink sound on receiving an ahelp that you didn't send
2021-10-06 17:25:27 +02:00

66 lines
1.9 KiB
C#

#nullable enable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Content.Client.UserInterface;
using Content.Client.Administration;
using Content.Shared;
using Robust.Client.Credits;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Shared.Network;
using Robust.Shared.GameObjects;
using YamlDotNet.RepresentationModel;
namespace Content.Client.Administration.UI
{
/// <summary>
/// This window connects to a BwoinkSystem channel. BwoinkSystem manages the rest.
/// </summary>
[GenerateTypedNameReferences]
public partial class BwoinkWindow : SS14Window
{
[Dependency] private readonly IEntitySystemManager _systemManager = default!;
private readonly NetUserId _channelId;
public BwoinkWindow(NetUserId channelId, string title)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
Title = title;
_channelId = channelId;
SenderLineEdit.OnTextEntered += Input_OnTextEntered;
MinSize = (650, 450);
}
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)
{
if (!string.IsNullOrWhiteSpace(args.Text))
{
var bwoink = _systemManager.GetEntitySystem<BwoinkSystem>();
bwoink.Send(_channelId, args.Text);
}
SenderLineEdit.Clear();
}
public void ReceiveLine(string text)
{
var formatted = new FormattedMessage(1);
formatted.AddText(text);
TextOutput.AddMessage(formatted);
}
}
}