mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
* Psionics It's a ton of stuff relating to the basic Psionics system and all the powers. I'm saving this as a bit of a sanity check before moving forward. Left to do: 1. Implementing the Psionic faction so that the chat works as intended. 2. Adding the start-state cooldown timers to the actions. * Cleaned up everything with the word 'Psionic' on it. Got the psionic chat working. Got some other stuff working * Some final psionic cleanup. The last batch of content. * Update RobustToolbox * rebased * Revert "Update RobustToolbox" This reverts commit c0cf35d03f828f6ccfeb05fcffd91cf074818fc9. * Update RobustToolbox * Revert "Update RobustToolbox" This reverts commit c4dc828df7912e063ea856b2a83a790bc88d1e09. * Update RobustToolbox * Psionics It's a ton of stuff relating to the basic Psionics system and all the powers. I'm saving this as a bit of a sanity check before moving forward. Left to do: 1. Implementing the Psionic faction so that the chat works as intended. 2. Adding the start-state cooldown timers to the actions. * Cleaned up everything with the word 'Psionic' on it. Got the psionic chat working. Got some other stuff working * Some final psionic cleanup. The last batch of content. * rebased * Cleaned up everything with the word 'Psionic' on it. Got the psionic chat working. Got some other stuff working * Broken Commit With these changes in place, the unit does not work. Recording them so i don't lose my work. * Brings it All Together. Dawn of the final Commit. Rebase completed. * Update RobustToolbox * Changed 'Station Events' to 'StationEvents' and cleaned up the Delta-V Events.yml file of duplicate events. * Delete ghost_roles.yml Duplicate. * Update familiars.yml * Update familiars.yml * Update GlimmerReactiveSystem.cs * Makes tinfoil hats craftable. * Decided I'm not dealing with adding fugitives or Glimmer Wisps right now. * Psionic invisibility won't work now that Eye component exists. Or at least, the integrator test won't psas. * Update special.yml * Added #nyanotrasen code or //Nyanotrasen code to many, many files. * Properly fixes comments. --------- Signed-off-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> Signed-off-by: PHCodes <47927305+PHCodes@users.noreply.github.com> Co-authored-by: Debug <sidneymaatman@gmail.com> Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com>
127 lines
3.8 KiB
C#
127 lines
3.8 KiB
C#
using Content.Shared.Chat;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using static Robust.Client.UserInterface.Controls.BaseButton;
|
|
|
|
namespace Content.Client.UserInterface.Systems.Chat.Controls;
|
|
|
|
public sealed class ChannelSelectorPopup : Popup
|
|
{
|
|
// order in which the channels show up in the channel selector
|
|
public static readonly ChatSelectChannel[] ChannelSelectorOrder =
|
|
{
|
|
ChatSelectChannel.Local,
|
|
ChatSelectChannel.Whisper,
|
|
ChatSelectChannel.Emotes,
|
|
ChatSelectChannel.Radio,
|
|
ChatSelectChannel.Telepathic, //Nyano - Summary: determines the order in which telepathic shows.
|
|
ChatSelectChannel.LOOC,
|
|
ChatSelectChannel.OOC,
|
|
ChatSelectChannel.Dead,
|
|
ChatSelectChannel.Admin
|
|
// NOTE: Console is not in there and it can never be permanently selected.
|
|
// You can, however, still submit commands as console by prefixing with /.
|
|
};
|
|
|
|
private readonly BoxContainer _channelSelectorHBox;
|
|
private readonly Dictionary<ChatSelectChannel, ChannelSelectorItemButton> _selectorStates = new();
|
|
private readonly ChatUIController _chatUIController;
|
|
|
|
public event Action<ChatSelectChannel>? Selected;
|
|
|
|
public ChannelSelectorPopup()
|
|
{
|
|
_channelSelectorHBox = new BoxContainer
|
|
{
|
|
Orientation = BoxContainer.LayoutOrientation.Horizontal,
|
|
SeparationOverride = 1
|
|
};
|
|
|
|
_chatUIController = UserInterfaceManager.GetUIController<ChatUIController>();
|
|
_chatUIController.SelectableChannelsChanged += SetChannels;
|
|
SetChannels(_chatUIController.SelectableChannels);
|
|
|
|
AddChild(_channelSelectorHBox);
|
|
}
|
|
|
|
public ChatSelectChannel? FirstChannel
|
|
{
|
|
get
|
|
{
|
|
foreach (var selector in _selectorStates.Values)
|
|
{
|
|
if (!selector.IsHidden)
|
|
return selector.Channel;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private bool IsPreferredAvailable()
|
|
{
|
|
var preferred = _chatUIController.MapLocalIfGhost(_chatUIController.GetPreferredChannel());
|
|
return _selectorStates.TryGetValue(preferred, out var selector) &&
|
|
!selector.IsHidden;
|
|
}
|
|
|
|
public void SetChannels(ChatSelectChannel channels)
|
|
{
|
|
var wasPreferredAvailable = IsPreferredAvailable();
|
|
|
|
_channelSelectorHBox.RemoveAllChildren();
|
|
|
|
foreach (var channel in ChannelSelectorOrder)
|
|
{
|
|
if (!_selectorStates.TryGetValue(channel, out var selector))
|
|
{
|
|
selector = new ChannelSelectorItemButton(channel);
|
|
_selectorStates.Add(channel, selector);
|
|
selector.OnPressed += OnSelectorPressed;
|
|
}
|
|
|
|
if ((channels & channel) == 0)
|
|
{
|
|
if (selector.Parent == _channelSelectorHBox)
|
|
{
|
|
_channelSelectorHBox.RemoveChild(selector);
|
|
}
|
|
}
|
|
else if (selector.IsHidden)
|
|
{
|
|
_channelSelectorHBox.AddChild(selector);
|
|
}
|
|
}
|
|
|
|
var isPreferredAvailable = IsPreferredAvailable();
|
|
if (!wasPreferredAvailable && isPreferredAvailable)
|
|
{
|
|
Select(_chatUIController.GetPreferredChannel());
|
|
}
|
|
else if (wasPreferredAvailable && !isPreferredAvailable)
|
|
{
|
|
Select(ChatSelectChannel.OOC);
|
|
}
|
|
}
|
|
|
|
private void OnSelectorPressed(ButtonEventArgs args)
|
|
{
|
|
var button = (ChannelSelectorItemButton) args.Button;
|
|
Select(button.Channel);
|
|
}
|
|
|
|
private void Select(ChatSelectChannel channel)
|
|
{
|
|
Selected?.Invoke(channel);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
if (!disposing)
|
|
return;
|
|
|
|
_chatUIController.SelectableChannelsChanged -= SetChannels;
|
|
}
|
|
}
|