LOOC will appear on top of your head (#21514)
* Oh well * Minor fixing up * HOLY BINGLE I DID IT * TOGGLE!
This commit is contained in:
@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Client.Chat.UI
|
namespace Content.Client.Chat.UI
|
||||||
{
|
{
|
||||||
@@ -13,7 +14,8 @@ namespace Content.Client.Chat.UI
|
|||||||
{
|
{
|
||||||
Emote,
|
Emote,
|
||||||
Say,
|
Say,
|
||||||
Whisper
|
Whisper,
|
||||||
|
Looc
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -60,12 +62,15 @@ namespace Content.Client.Chat.UI
|
|||||||
case SpeechType.Whisper:
|
case SpeechType.Whisper:
|
||||||
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox");
|
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:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
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;
|
_chatManager = chatManager;
|
||||||
_senderEntity = senderEntity;
|
_senderEntity = senderEntity;
|
||||||
@@ -75,7 +80,7 @@ namespace Content.Client.Chat.UI
|
|||||||
// Use text clipping so new messages don't overlap old ones being pushed up.
|
// Use text clipping so new messages don't overlap old ones being pushed up.
|
||||||
RectClipContent = true;
|
RectClipContent = true;
|
||||||
|
|
||||||
var bubble = BuildBubble(text, speechStyleClass);
|
var bubble = BuildBubble(text, speechStyleClass, fontColor);
|
||||||
|
|
||||||
AddChild(bubble);
|
AddChild(bubble);
|
||||||
|
|
||||||
@@ -86,7 +91,7 @@ namespace Content.Client.Chat.UI
|
|||||||
_verticalOffsetAchieved = -ContentSize.Y;
|
_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)
|
protected override void FrameUpdate(FrameEventArgs args)
|
||||||
{
|
{
|
||||||
@@ -164,18 +169,29 @@ namespace Content.Client.Chat.UI
|
|||||||
|
|
||||||
public sealed class TextSpeechBubble : SpeechBubble
|
public sealed class TextSpeechBubble : SpeechBubble
|
||||||
{
|
{
|
||||||
public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string 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)
|
: 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
|
var label = new RichTextLabel
|
||||||
{
|
{
|
||||||
MaxWidth = 256,
|
MaxWidth = 256,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (fontColor != null)
|
||||||
|
{
|
||||||
|
var msg = new FormattedMessage();
|
||||||
|
msg.PushColor(fontColor.Value);
|
||||||
|
msg.AddMarkup(text);
|
||||||
|
label.SetMessage(msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
label.SetMessage(text);
|
label.SetMessage(text);
|
||||||
|
}
|
||||||
|
|
||||||
var panel = new PanelContainer
|
var panel = new PanelContainer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
<CheckBox Name="ShowHeldItemCheckBox" Text="{Loc 'ui-options-show-held-item'}" />
|
<CheckBox Name="ShowHeldItemCheckBox" Text="{Loc 'ui-options-show-held-item'}" />
|
||||||
<CheckBox Name="ShowCombatModeIndicatorsCheckBox" Text="{Loc 'ui-options-show-combat-mode-indicators'}" />
|
<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">
|
<BoxContainer Orientation="Horizontal">
|
||||||
<CheckBox Name="ViewportStretchCheckBox" Text="{Loc 'ui-options-vp-stretch'}" />
|
<CheckBox Name="ViewportStretchCheckBox" Text="{Loc 'ui-options-vp-stretch'}" />
|
||||||
<BoxContainer Name="ViewportScaleBox" Orientation="Horizontal">
|
<BoxContainer Name="ViewportScaleBox" Orientation="Horizontal">
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
|
|
||||||
ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
|
ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
|
||||||
ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
|
ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
|
||||||
|
ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
|
||||||
IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
|
IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
|
||||||
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
|
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
|
||||||
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
|
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
|
||||||
@@ -121,6 +122,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
|
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
|
||||||
ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow);
|
ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow);
|
||||||
ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
|
ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
|
||||||
|
ShowLoocAboveHeadCheckBox.Pressed = _cfg.GetCVar(CCVars.LoocAboveHeadShow);
|
||||||
ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);
|
ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);
|
||||||
|
|
||||||
_cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
|
_cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
|
||||||
@@ -168,6 +170,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
|
||||||
_cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed);
|
||||||
_cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed);
|
||||||
|
_cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed);
|
||||||
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
|
||||||
_cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);
|
_cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);
|
||||||
|
|
||||||
@@ -205,6 +208,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
|
var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
|
||||||
var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow);
|
var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow);
|
||||||
var isCombatModeIndicatorsSame = ShowCombatModeIndicatorsCheckBox.Pressed == _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
|
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 isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
|
||||||
var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
|
var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
|
||||||
var isLayoutSame = HudLayoutOption.SelectedMetadata is string opt && opt == _cfg.GetCVar(CCVars.UILayout);
|
var isLayoutSame = HudLayoutOption.SelectedMetadata is string opt && opt == _cfg.GetCVar(CCVars.UILayout);
|
||||||
@@ -221,6 +225,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
isHudThemeSame &&
|
isHudThemeSame &&
|
||||||
isShowHeldItemSame &&
|
isShowHeldItemSame &&
|
||||||
isCombatModeIndicatorsSame &&
|
isCombatModeIndicatorsSame &&
|
||||||
|
isLoocShowSame &&
|
||||||
isFpsCounterVisibleSame &&
|
isFpsCounterVisibleSame &&
|
||||||
isWidthSame &&
|
isWidthSame &&
|
||||||
isLayoutSame;
|
isLayoutSame;
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ public sealed class ChatUIController : UIController
|
|||||||
UpdateChannelPermissions();
|
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);
|
var ent = EntityManager.GetEntity(msg.SenderEntity);
|
||||||
|
|
||||||
@@ -379,8 +379,11 @@ public sealed class ChatUIController : UIController
|
|||||||
return;
|
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.
|
// 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)
|
foreach (var message in messages)
|
||||||
{
|
{
|
||||||
@@ -843,6 +846,15 @@ public sealed class ChatUIController : UIController
|
|||||||
case ChatChannel.Emotes:
|
case ChatChannel.Emotes:
|
||||||
AddSpeechBubble(msg, SpeechBubble.SpeechType.Emote);
|
AddSpeechBubble(msg, SpeechBubble.SpeechType.Emote);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ChatChannel.LOOC:
|
||||||
|
if (_cfg.GetCVar(CCVars.LoocAboveHeadShow))
|
||||||
|
{
|
||||||
|
const string prefixText = "(LOOC: ";
|
||||||
|
const string prefixEndText = ")";
|
||||||
|
AddSpeechBubble(msg, SpeechBubble.SpeechType.Looc, prefixText, prefixEndText);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -645,6 +645,9 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<bool> CombatModeIndicatorsPointShow =
|
public static readonly CVarDef<bool> CombatModeIndicatorsPointShow =
|
||||||
CVarDef.Create("hud.combat_mode_indicators_point_show", true, CVar.ARCHIVE | CVar.CLIENTONLY);
|
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 =
|
public static readonly CVarDef<float> HudHeldItemOffset =
|
||||||
CVarDef.Create("hud.held_item_offset", 28f, CVar.ARCHIVE | CVar.CLIENTONLY);
|
CVarDef.Create("hud.held_item_offset", 28f, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ ui-options-volume-percent = { TOSTRING($volume, "P0") }
|
|||||||
|
|
||||||
ui-options-show-held-item = Show held item next to cursor?
|
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-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-vsync = VSync
|
||||||
ui-options-fullscreen = Fullscreen
|
ui-options-fullscreen = Fullscreen
|
||||||
ui-options-lighting-label = Lighting Quality:
|
ui-options-lighting-label = Lighting Quality:
|
||||||
|
|||||||
Reference in New Issue
Block a user