Chairbender Chat (#3794)

* #272 restructure and restyle chat line edit section

* #272 no arrow, actually change id on channel changer

* #272 nice round chat channel picker

* #272 add chat channel selection logic, and auto-select
when a prefix is entered

* #272 consistent width of chat channel btn

* #272 only show admin channel filter if asay perms

* #272 add tutorial info on chat prefixes

* #272 added chat filter button

* #272 added chat filter button

* #272 WIP on filter popup

* #272 fix filter popup pressed / unpressed logic

* #272 fix filter popup positioning and layout

* #272 WIP channel filter logic

* #272 WIP channel filter logic

* #272 WIP refactoring how chatbox / manager manages available filters and channels to send on

* #272 WIP implementing filtering UI / logic
and refactoring how chat UI is managed

* #272 fix various bugs with new chat filter / selector logic

* #272 remove outdated todos

* #272 WIP working chat window resize

* #272 bounded chatbox resizing

* #272 alertUI moves with resized chat

* #272 WIP making alertUI not be too large when changing size / UIScale

* #272 WIP fixing window / uiscale adjustment

* #272 WIP hacky approach for resizing, will try another approach

* #272 implement hacky approach for bounded chat resize

* #272 no resizing of lobby chat

* #272 WIP adding unread marker to chat filters

* #272 basic working unread chat message indicators

* #272 WIP adding horizontal channel selector items

* #272 horizontal channel selector popup

* #272 workaround for chat selector staying highlighted when right clicking it while toggled

* #272 workaround for chat selector staying highlighted when right clicking it while toggled

* #272 wip trying to add tests for chatbox

* #272 remove test, not really possible with current system

* #272 merge latest

* #272 merge latest

* #272 fix csproj changes

* It works if you disable the lobby

* Fixes lobby chat

* Adds more channel focusses

* Channel cycler

* Address review

* Address nitpicks

* Address more of the review

* Fix chat post-viewport

* Finalize review stuff

Co-authored-by: chairbender <kwhipke1@gmail.com>
Co-authored-by: ike709 <sparebytes@protonmail.com>
This commit is contained in:
ike709
2021-04-20 18:39:39 -05:00
committed by GitHub
parent d7d37f10d1
commit 055059ab5c
24 changed files with 1435 additions and 279 deletions

View File

@@ -1,6 +1,10 @@
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Chat;
using Content.Client.Interfaces.Chat;
using Content.Client.UserInterface.Stylesheets;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
namespace Content.Client.UserInterface
{
@@ -9,6 +13,7 @@ namespace Content.Client.UserInterface
/// </summary>
public sealed class AlertsUI : Control
{
public const float ChatSeparation = 38f;
public GridContainer Grid { get; }
public AlertsUI()
@@ -39,6 +44,36 @@ namespace Content.Client.UserInterface
MinSize = (64, 64);
}
protected override void EnteredTree()
{
base.EnteredTree();
var _chatManager = IoCManager.Resolve<IChatManager>();
_chatManager.OnChatBoxResized += OnChatResized;
OnChatResized(new ChatResizedEventArgs(ChatBox.InitialChatBottom));
}
protected override void ExitedTree()
{
base.ExitedTree();
var _chatManager = IoCManager.Resolve<IChatManager>();
_chatManager.OnChatBoxResized -= OnChatResized;
}
private void OnChatResized(ChatResizedEventArgs chatResizedEventArgs)
{
// resize us to fit just below the chatbox
var _chatManager = IoCManager.Resolve<IChatManager>();
if (_chatManager.CurrentChatBox != null)
{
LayoutContainer.SetMarginTop(this, chatResizedEventArgs.NewBottom + ChatSeparation);
}
else
{
LayoutContainer.SetMarginTop(this, 250);
}
}
// This makes no sense but I'm leaving it in place in case I break anything by removing it.
protected override void Resized()

View File

@@ -141,8 +141,12 @@ namespace Content.Client.UserInterface
AddHeader("ui-options-header-ui");
AddButton(ContentKeyFunctions.FocusChat);
AddButton(ContentKeyFunctions.FocusLocalChat);
AddButton(ContentKeyFunctions.FocusRadio);
AddButton(ContentKeyFunctions.FocusOOC);
AddButton(ContentKeyFunctions.FocusAdminChat);
AddButton(ContentKeyFunctions.CycleChatChannelForward);
AddButton(ContentKeyFunctions.CycleChatChannelBackward);
AddButton(ContentKeyFunctions.OpenCharacterMenu);
AddButton(ContentKeyFunctions.OpenContextMenu);
AddButton(ContentKeyFunctions.OpenCraftingMenu);

View File

@@ -1,5 +1,6 @@
#nullable enable
using System.Linq;
using Content.Client.Chat;
using Content.Client.GameObjects.EntitySystems;
using Content.Client.UserInterface.Controls;
using Content.Client.Utility;
@@ -18,6 +19,7 @@ namespace Content.Client.UserInterface.Stylesheets
public const string StyleClassBorderedWindowPanel = "BorderedWindowPanel";
public const string StyleClassInventorySlotBackground = "InventorySlotBackground";
public const string StyleClassHandSlotHighlight = "HandSlotHighlight";
public const string StyleClassChatSubPanel = "ChatSubPanel";
public const string StyleClassTransparentBorderedWindowPanel = "TransparentBorderedWindowPanel";
public const string StyleClassHotbarPanel = "HotbarPanel";
public const string StyleClassTooltipPanel = "tooltipBox";
@@ -31,6 +33,9 @@ namespace Content.Client.UserInterface.Stylesheets
public const string StyleClassHotbarSlotNumber = "hotbarSlotNumber";
public const string StyleClassActionSearchBox = "actionSearchBox";
public const string StyleClassActionMenuItemRevoked = "actionMenuItemRevoked";
public const string StyleClassChatLineEdit = "chatLineEdit";
public const string StyleClassChatChannelSelectorButton = "chatSelectorOptionButton";
public const string StyleClassChatFilterOptionButton = "chatFilterOptionButton";
public const string StyleClassContextMenuCount = "contextMenuCount";
public const string StyleClassSliderRed = "Red";
@@ -208,6 +213,22 @@ namespace Content.Client.UserInterface.Stylesheets
};
topButtonSquare.SetPatchMargin(StyleBox.Margin.Horizontal, 0);
var chatChannelButtonTex = resCache.GetTexture("/Textures/Interface/Nano/rounded_button.svg.96dpi.png");
var chatChannelButton = new StyleBoxTexture
{
Texture = chatChannelButtonTex,
};
chatChannelButton.SetPatchMargin(StyleBox.Margin.All, 5);
chatChannelButton.SetPadding(StyleBox.Margin.All, 2);
var chatFilterButtonTex = resCache.GetTexture("/Textures/Interface/Nano/rounded_button_bordered.svg.96dpi.png");
var chatFilterButton = new StyleBoxTexture
{
Texture = chatFilterButtonTex,
};
chatFilterButton.SetPatchMargin(StyleBox.Margin.All, 5);
chatFilterButton.SetPadding(StyleBox.Margin.All, 2);
var textureInvertedTriangle = resCache.GetTexture("/Textures/Interface/Nano/inverted_triangle.svg.png");
var lineEditTex = resCache.GetTexture("/Textures/Interface/Nano/lineedit.png");
@@ -218,6 +239,13 @@ namespace Content.Client.UserInterface.Stylesheets
lineEdit.SetPatchMargin(StyleBox.Margin.All, 3);
lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5);
var chatSubBGTex = resCache.GetTexture("/Textures/Interface/Nano/chat_sub_background.png");
var chatSubBG = new StyleBoxTexture
{
Texture = chatSubBGTex,
};
chatSubBG.SetPatchMargin(StyleBox.Margin.All, 2);
var actionSearchBoxTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_dark_thin_border.png");
var actionSearchBox = new StyleBoxTexture
{
@@ -540,6 +568,20 @@ namespace Content.Client.UserInterface.Stylesheets
{
new StyleProperty("font-color", Color.Gray),
}),
// Chat lineedit - we don't actually draw a stylebox around the lineedit itself, we put it around the
// input + other buttons, so we must clear the default stylebox
new StyleRule(new SelectorElement(typeof(LineEdit), new[] {StyleClassChatLineEdit}, null, null),
new[]
{
new StyleProperty(LineEdit.StylePropertyStyleBox, new StyleBoxEmpty()),
}),
// chat subpanels (chat lineedit backing, popup backings)
new StyleRule(new SelectorElement(typeof(PanelContainer), new[] {StyleClassChatSubPanel}, null, null),
new[]
{
new StyleProperty(PanelContainer.StylePropertyPanel, chatSubBG),
}),
// Action searchbox lineedit
new StyleRule(new SelectorElement(typeof(LineEdit), new[] {StyleClassActionSearchBox}, null, null),
@@ -931,6 +973,33 @@ namespace Content.Client.UserInterface.Stylesheets
new StyleProperty(Slider.StylePropertyFill, sliderFillBlue),
}),
// chat channel option selector
new StyleRule(new SelectorElement(typeof(Button), new[] {StyleClassChatChannelSelectorButton}, null, null), new[]
{
new StyleProperty(Button.StylePropertyStyleBox, chatChannelButton),
}),
// chat filter button
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] {StyleClassChatFilterOptionButton}, null, null), new[]
{
new StyleProperty(ContainerButton.StylePropertyStyleBox, chatFilterButton),
}),
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] {StyleClassChatFilterOptionButton}, null, new[] {ContainerButton.StylePseudoClassNormal}), new[]
{
new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorDefault),
}),
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] {StyleClassChatFilterOptionButton}, null, new[] {ContainerButton.StylePseudoClassHover}), new[]
{
new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorHovered),
}),
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] {StyleClassChatFilterOptionButton}, null, new[] {ContainerButton.StylePseudoClassPressed}), new[]
{
new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorPressed),
}),
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] {StyleClassChatFilterOptionButton}, null, new[] {ContainerButton.StylePseudoClassDisabled}), new[]
{
new StyleProperty(Control.StylePropertyModulateSelf, ButtonColorDisabled),
}),
// OptionButton
new StyleRule(new SelectorElement(typeof(OptionButton), null, null, null), new[]
{