Files
wwdpublic/Content.Client/UserInterface/Systems/Chat/Controls/ChatInputBox.xaml.cs
Cinkafox 65208f0165 [Add] new ui (#497)
* - add: StyleSheetify

* - add: APC style

* - tweak: Select only APC now!

* - fix: Window positioning

* - fix: animations

* - add: Fancy chat

* - tweak: change some margin think

* - fix: add assemblies of stylesheetify for packaging

* - tweak: update StyleSheetify

* - add: custom LauncherConnection

* - tweak: change to paper

* - tweak: Update StyleSheetify

* - add: fancy lobby screen

* - tweak: some beauty think in lobby screen

* - add: new icons

* - tweak: change icons

* - tweak: //WWDP EDIT

* - fix: disable style while testing

* - fix: Channel Popup button style revert

* - fix: test again

* - tweak: Update StyleSheetify
2025-05-17 14:30:12 +03:00

73 lines
2.7 KiB
C#

using Content.Client.Stylesheets;
using Content.Shared.Chat;
using Content.Shared.Input;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface.Systems.Chat.Controls;
[Virtual]
public class ChatInputBox : PanelContainer
{
public readonly ChannelSelectorButton ChannelSelector;
public readonly HistoryLineEdit Input;
public readonly ChannelFilterButton FilterButton;
protected readonly BoxContainer Container;
protected ChatChannel ActiveChannel { get; private set; } = ChatChannel.Local;
public ChatInputBox()
{
Container = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
SeparationOverride = 4,
MinHeight = 30
};
AddChild(Container);
ChannelSelector = new ChannelSelectorButton
{
Name = "ChannelSelector",
ToggleMode = true,
StyleClasses = {"chatSelectorOptionButton"},
Margin = new Thickness(5,0,2,0), // WWDP EDIT
MinWidth = 75
};
Container.AddChild(ChannelSelector);
Input = new HistoryLineEdit
{
Name = "Input",
PlaceHolder = GetChatboxInfoPlaceholder(),
HorizontalExpand = true,
StyleClasses = {"chatLineEdit"}
};
Container.AddChild(Input);
FilterButton = new ChannelFilterButton
{
Name = "FilterButton",
Margin = new Thickness(2,0,5,0), // WWDP EDIT
StyleBoxOverride = new StyleBoxEmpty() // WWDP EDIT
};
Container.AddChild(FilterButton);
AddStyleClass(StyleNano.StyleClassChatSubPanel);
ChannelSelector.OnChannelSelect += UpdateActiveChannel;
}
private void UpdateActiveChannel(ChatSelectChannel selectedChannel)
{
ActiveChannel = (ChatChannel) selectedChannel;
}
private static string GetChatboxInfoPlaceholder()
{
return (BoundKeyHelper.IsBound(ContentKeyFunctions.FocusChat), BoundKeyHelper.IsBound(ContentKeyFunctions.CycleChatChannelForward)) switch
{
(true, true) => Loc.GetString("hud-chatbox-info", ("talk-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.FocusChat)), ("cycle-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.CycleChatChannelForward))),
(true, false) => Loc.GetString("hud-chatbox-info-talk", ("talk-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.FocusChat))),
(false, true) => Loc.GetString("hud-chatbox-info-cycle", ("cycle-key", BoundKeyHelper.ShortKeyName(ContentKeyFunctions.CycleChatChannelForward))),
(false, false) => Loc.GetString("hud-chatbox-info-unbound")
};
}
}