* UI is an abbreviation, in XAML. * Chat improvements. Changing the "selected" channel on the chat box is now only done via the tab cycle or clicking the button. Prefix chars like [ will temporarily replace the active chat channel. This is based 100% on message box contents so there's no input eating garbage or anything. Pressing specific channel focusing keys inserts the correct prefix character, potentially replacing an existing one. Existing chat contents are left in place just fine and selected so you can easily delete them (but are not forced to). Channel focusing keys now match the QWERTY key codes. Deadchat works now. Console can no longer be selected as a chat channel, but you can still use it with the / prefix. Refactored the connection between chat manager and chat box so that it's event based, reducing tons of spaghetti everywhere. Main chat box control uses XAML now. General cleanup. Added focus hotkeys for deadchat/console. Also added prefix for deadchat. Local chat is mapped to deadchat when a ghost. Probably more stuff I can't think of right now. * Add preferred channel system to chat box to automatically select local. I can't actually test this works because the non-lobby chat box code is complete disastrous spaghetti and i need to refactor it. * Move chatbox resizing and all that to a subclass. Refine preferred channel & deadchat mapping code further. * Don't do prefixes for channels you don't have access to. * Change format on channel select popup. * Clean up code with console handling somewhat.
94 lines
3.2 KiB
C#
94 lines
3.2 KiB
C#
using Content.Client.Chat.Managers;
|
|
using Content.Client.Chat.UI;
|
|
using Content.Client.Stylesheets;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Client.Alerts.UI
|
|
{
|
|
/// <summary>
|
|
/// The status effects display on the right side of the screen.
|
|
/// </summary>
|
|
public sealed class AlertsUI : Control
|
|
{
|
|
public const float ChatSeparation = 38f;
|
|
public GridContainer Grid { get; }
|
|
|
|
public AlertsUI()
|
|
{
|
|
LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.Begin);
|
|
LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.End);
|
|
LayoutContainer.SetAnchorTop(this, 0f);
|
|
LayoutContainer.SetAnchorRight(this, 1f);
|
|
LayoutContainer.SetAnchorBottom(this, 1f);
|
|
LayoutContainer.SetMarginBottom(this, -180);
|
|
LayoutContainer.SetMarginTop(this, 250);
|
|
LayoutContainer.SetMarginRight(this, -10);
|
|
var panelContainer = new PanelContainer
|
|
{
|
|
StyleClasses = {StyleNano.StyleClassTransparentBorderedWindowPanel},
|
|
HorizontalAlignment = HAlignment.Right,
|
|
VerticalAlignment = VAlignment.Top
|
|
};
|
|
AddChild(panelContainer);
|
|
|
|
Grid = new GridContainer
|
|
{
|
|
MaxGridHeight = 64,
|
|
ExpandBackwards = true
|
|
};
|
|
panelContainer.AddChild(Grid);
|
|
|
|
MinSize = (64, 64);
|
|
}
|
|
|
|
protected override void EnteredTree()
|
|
{
|
|
base.EnteredTree();
|
|
var _chatManager = IoCManager.Resolve<IChatManager>();
|
|
_chatManager.OnChatBoxResized += OnChatResized;
|
|
OnChatResized(new ChatResizedEventArgs(HudChatBox.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()
|
|
{
|
|
// TODO: Can rework this once https://github.com/space-wizards/RobustToolbox/issues/1392 is done,
|
|
// this is here because there isn't currently a good way to allow the grid to adjust its height based
|
|
// on constraints, otherwise we would use anchors to lay it out
|
|
base.Resized();
|
|
Grid.MaxGridHeight = Height;
|
|
}
|
|
|
|
protected override void UIScaleChanged()
|
|
{
|
|
Grid.MaxGridHeight = Height;
|
|
base.UIScaleChanged();
|
|
}
|
|
}
|
|
}
|