* inital * force them to WRITE * b * new system * aaaa * b * bbbb * translations * add tts support for evacuation reason * PaddedStool_Sprite&Prototype 8 colors of pudded stool. * PaddedStool_Crafting * ComfyChair_Sprites&Prototype * ComfyChair_Crafting * Sofa_Sprites&Prototype * Sofa_Crafting * Sofa_SpriteFix * Sofa_RemoveSomeSprites * Revert "Sofa_RemoveSomeSprites" This reverts commit b110e9bda9a75cf6337c4efacd4888967d0e1fe6. * Revert "Sofa_SpriteFix" This reverts commit bfa8a17c16c57d2f70d64eb8dd54ae94ac48b248. * Revert "Sofa_Crafting" This reverts commit 89daadcb1e9d45a84281a5fdf998ab6c6f6b0f9b. * Revert "Sofa_Sprites&Prototype" This reverts commit 73cd0be403e03b1852a4632e1b6a8ca7526c5622. * Revert "ComfyChair_Crafting" This reverts commit 940f9665dd998090b43bca596ef3800c0c6ba89b. * Revert "ComfyChair_Sprites&Prototype" This reverts commit 2c909de5d3e3f4ab5efa1cbef6b5feda32d05a80. * Revert "PaddedStool_Crafting" This reverts commit 82040ba82c0190f2a52614fd3573e77586d73802. * Revert "PaddedStool_Sprite&Prototype" This reverts commit c5241a03ffeccbb4a18ab0f108d05c4fe1e047ba. * Sprites&Meta * Crafting * Tweaks * PaddedStool_tweaks * Add Random Spawners * remove old colored chairs * Sprites&Meta * Changing prototypes * Adding to Theater vend * Sprite_Change * Sprite_Change * Prototype_Changes Is this exactly how it should be?... * add bouquet * Not very useful functionality has been removed * Update toys.yml * Now you need cloth to made bouquet * Update toys.yml * I hope. I done right * Update toys.yml * Update bouquet.yml * Update toys.yml * Update Resources/Prototypes/Recipes/Crafting/Graphs/toys.yml Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> * add musician jumpskirt to loadouts * better bouquet * pAIs can now be inserted into plushies. * No more bad bleed * More Tourniquets, hopefully fixed YML check. * deals a bit of bloodloss * Reduce Stack Count. * fix tourniquet * add migrations for old chair types and add few new --------- Co-authored-by: Mr. 27 <koolthunder019@gmail.com> Co-authored-by: Арт <123451459+JustArt1m@users.noreply.github.com> Co-authored-by: Green resomi <135062489+Yeah-I-listening-Hollywood-undead@users.noreply.github.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: Moomoobeef <moomoobeef@protonmail.com> Co-authored-by: PoorMansDreams <andyroblox14@gmail.com>
134 lines
4.9 KiB
C#
134 lines
4.9 KiB
C#
using Content.Client.UserInterface.Controls;
|
|
using System.Threading;
|
|
using Content.Shared.CCVar;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Utility;
|
|
using Timer = Robust.Shared.Timing.Timer;
|
|
|
|
namespace Content.Client.Communications.UI
|
|
{
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class CommunicationsConsoleMenu : FancyWindow
|
|
{
|
|
private CommunicationsConsoleBoundUserInterface Owner { get; set; }
|
|
private readonly CancellationTokenSource _timerCancelTokenSource = new();
|
|
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
|
|
public CommunicationsConsoleMenu(CommunicationsConsoleBoundUserInterface owner)
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
RobustXamlLoader.Load(this);
|
|
|
|
Owner = owner;
|
|
|
|
var loc = IoCManager.Resolve<ILocalizationManager>();
|
|
MessageInput.Placeholder = new Rope.Leaf(loc.GetString("comms-console-menu-announcement-placeholder"));
|
|
|
|
var maxAnnounceLength = _cfg.GetCVar(CCVars.ChatMaxAnnouncementLength);
|
|
MessageInput.OnTextChanged += (args) =>
|
|
{
|
|
if (args.Control.TextLength > maxAnnounceLength)
|
|
{
|
|
AnnounceButton.Disabled = true;
|
|
AnnounceButton.ToolTip = Loc.GetString("comms-console-message-too-long");
|
|
}
|
|
else
|
|
{
|
|
AnnounceButton.Disabled = !owner.CanAnnounce;
|
|
AnnounceButton.ToolTip = null;
|
|
}
|
|
};
|
|
|
|
AnnounceButton.OnPressed += (_) => Owner.AnnounceButtonPressed(Rope.Collapse(MessageInput.TextRope));
|
|
AnnounceButton.Disabled = !owner.CanAnnounce;
|
|
|
|
BroadcastButton.OnPressed += (_) => Owner.BroadcastButtonPressed(Rope.Collapse(MessageInput.TextRope));
|
|
BroadcastButton.Disabled = !owner.CanBroadcast;
|
|
|
|
AlertLevelButton.OnItemSelected += args =>
|
|
{
|
|
var metadata = AlertLevelButton.GetItemMetadata(args.Id);
|
|
if (metadata != null && metadata is string cast)
|
|
{
|
|
Owner.AlertLevelSelected(cast);
|
|
}
|
|
};
|
|
AlertLevelButton.Disabled = !owner.AlertLevelSelectable;
|
|
|
|
EmergencyShuttleButton.OnPressed += (_) => Owner.EmergencyShuttleButtonPressed();
|
|
EmergencyShuttleButton.Disabled = !owner.CanCall;
|
|
|
|
UpdateCountdown();
|
|
Timer.SpawnRepeating(1000, UpdateCountdown, _timerCancelTokenSource.Token);
|
|
}
|
|
|
|
// The current alert could make levels unselectable, so we need to ensure that the UI reacts properly.
|
|
// If the current alert is unselectable, the only item in the alerts list will be
|
|
// the current alert. Otherwise, it will be the list of alerts, with the current alert
|
|
// selected.
|
|
public void UpdateAlertLevels(List<string>? alerts, string currentAlert)
|
|
{
|
|
AlertLevelButton.Clear();
|
|
|
|
if (alerts == null)
|
|
{
|
|
var name = currentAlert;
|
|
if (Loc.TryGetString($"alert-level-{currentAlert}", out var locName))
|
|
{
|
|
name = locName;
|
|
}
|
|
AlertLevelButton.AddItem(name);
|
|
AlertLevelButton.SetItemMetadata(AlertLevelButton.ItemCount - 1, currentAlert);
|
|
}
|
|
else
|
|
{
|
|
foreach (var alert in alerts)
|
|
{
|
|
var name = alert;
|
|
if (Loc.TryGetString($"alert-level-{alert}", out var locName))
|
|
{
|
|
name = locName;
|
|
}
|
|
AlertLevelButton.AddItem(name);
|
|
AlertLevelButton.SetItemMetadata(AlertLevelButton.ItemCount - 1, alert);
|
|
if (alert == currentAlert)
|
|
{
|
|
AlertLevelButton.Select(AlertLevelButton.ItemCount - 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void UpdateCountdown()
|
|
{
|
|
if (!Owner.CountdownStarted)
|
|
{
|
|
CountdownLabel.SetMessage("");
|
|
EmergencyShuttleButton.Text = Loc.GetString("comms-console-menu-call-shuttle");
|
|
return;
|
|
}
|
|
|
|
EmergencyShuttleButton.Text = Loc.GetString("comms-console-menu-recall-shuttle");
|
|
CountdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s");
|
|
}
|
|
|
|
public override void Close()
|
|
{
|
|
base.Close();
|
|
|
|
_timerCancelTokenSource.Cancel();
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
if (disposing)
|
|
_timerCancelTokenSource.Cancel();
|
|
}
|
|
}
|
|
}
|