using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
+using Robust.Shared.Utility;
namespace Content.Client.Chat.UI
{
{
Emote,
Say,
- Whisper
+ Whisper,
+ Looc
}
/// <summary>
case SpeechType.Whisper:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox");
+ case SpeechType.Looc:
+ return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "emoteBox", Color.FromHex("#48d1cc"));
+
default:
throw new ArgumentOutOfRangeException();
}
}
- public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
+ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
{
_chatManager = chatManager;
_senderEntity = senderEntity;
// Use text clipping so new messages don't overlap old ones being pushed up.
RectClipContent = true;
- var bubble = BuildBubble(text, speechStyleClass);
+ var bubble = BuildBubble(text, speechStyleClass, fontColor);
AddChild(bubble);
_verticalOffsetAchieved = -ContentSize.Y;
}
- protected abstract Control BuildBubble(string text, string speechStyleClass);
+ protected abstract Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null);
protected override void FrameUpdate(FrameEventArgs args)
{
public sealed class TextSpeechBubble : SpeechBubble
{
- public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
- : base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass)
+ public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
+ : base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass, fontColor)
{
}
- protected override Control BuildBubble(string text, string speechStyleClass)
+ protected override Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null)
{
var label = new RichTextLabel
{
MaxWidth = 256,
};
- label.SetMessage(text);
+
+ if (fontColor != null)
+ {
+ var msg = new FormattedMessage();
+ msg.PushColor(fontColor.Value);
+ msg.AddMarkup(text);
+ label.SetMessage(msg);
+ }
+ else
+ {
+ label.SetMessage(text);
+ }
var panel = new PanelContainer
{
</BoxContainer>
<CheckBox Name="ShowHeldItemCheckBox" Text="{Loc 'ui-options-show-held-item'}" />
<CheckBox Name="ShowCombatModeIndicatorsCheckBox" Text="{Loc 'ui-options-show-combat-mode-indicators'}" />
+ <CheckBox Name="ShowLoocAboveHeadCheckBox" Text="{Loc 'ui-options-show-looc-on-head'}" />
<BoxContainer Orientation="Horizontal">
<CheckBox Name="ViewportStretchCheckBox" Text="{Loc 'ui-options-vp-stretch'}" />
<BoxContainer Name="ViewportScaleBox" Orientation="Horizontal">
ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
+ ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow);
ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
+ ShowLoocAboveHeadCheckBox.Pressed = _cfg.GetCVar(CCVars.LoocAboveHeadShow);
ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);
_cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed);
_cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed);
+ _cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
_cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);
var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow);
var isCombatModeIndicatorsSame = ShowCombatModeIndicatorsCheckBox.Pressed == _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
+ var isLoocShowSame = ShowLoocAboveHeadCheckBox.Pressed == _cfg.GetCVar(CCVars.LoocAboveHeadShow);
var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
var isLayoutSame = HudLayoutOption.SelectedMetadata is string opt && opt == _cfg.GetCVar(CCVars.UILayout);
isHudThemeSame &&
isShowHeldItemSame &&
isCombatModeIndicatorsSame &&
+ isLoocShowSame &&
isFpsCounterVisibleSame &&
isWidthSame &&
isLayoutSame;
UpdateChannelPermissions();
}
- private void AddSpeechBubble(ChatMessage msg, SpeechBubble.SpeechType speechType)
+ private void AddSpeechBubble(ChatMessage msg, SpeechBubble.SpeechType speechType, string? prefixText = null, string? prefixEndText = null)
{
var ent = EntityManager.GetEntity(msg.SenderEntity);
return;
}
+ // Kind of shitty way to add prefixes but hey it works!
+ string Message = prefixText + msg.Message + prefixEndText;
+
// msg.Message should be the string that a user sent over text, without any added markup.
- var messages = SplitMessage(msg.Message);
+ var messages = SplitMessage(Message);
foreach (var message in messages)
{
case ChatChannel.Emotes:
AddSpeechBubble(msg, SpeechBubble.SpeechType.Emote);
break;
+
+ case ChatChannel.LOOC:
+ if (_cfg.GetCVar(CCVars.LoocAboveHeadShow))
+ {
+ const string prefixText = "(LOOC: ";
+ const string prefixEndText = ")";
+ AddSpeechBubble(msg, SpeechBubble.SpeechType.Looc, prefixText, prefixEndText);
+ }
+ break;
}
}
public static readonly CVarDef<bool> CombatModeIndicatorsPointShow =
CVarDef.Create("hud.combat_mode_indicators_point_show", true, CVar.ARCHIVE | CVar.CLIENTONLY);
+ public static readonly CVarDef<bool> LoocAboveHeadShow =
+ CVarDef.Create("hud.show_looc_above_head", true, CVar.ARCHIVE | CVar.CLIENTONLY);
+
public static readonly CVarDef<float> HudHeldItemOffset =
CVarDef.Create("hud.held_item_offset", 28f, CVar.ARCHIVE | CVar.CLIENTONLY);
ui-options-show-held-item = Show held item next to cursor?
ui-options-show-combat-mode-indicators = Show combat mode indicators with cursor?
+ui-options-show-looc-on-head = Show LOOC chat above characters head?
ui-options-vsync = VSync
ui-options-fullscreen = Fullscreen
ui-options-lighting-label = Lighting Quality: