Skip to content

Commit

Permalink
Merge branch 'xtray85:master' into fire
Browse files Browse the repository at this point in the history
  • Loading branch information
FrisKisDr authored Nov 10, 2023
2 parents be7e099 + 47b5742 commit 328b577
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
28 changes: 20 additions & 8 deletions Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Client.Chat.UI
{
Expand Down Expand Up @@ -62,14 +63,14 @@ public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, Enti
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox");

case SpeechType.Looc:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "emoteBox");
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "sayBox", 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;
Expand All @@ -79,7 +80,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
// 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);

Expand All @@ -90,7 +91,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
_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)
{
Expand Down Expand Up @@ -168,18 +169,29 @@ public void FadeNow()

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
{
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</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">
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public GraphicsTab()

ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
Expand All @@ -121,6 +122,7 @@ public GraphicsTab()
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());
Expand Down Expand Up @@ -168,6 +170,7 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_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);

Expand Down Expand Up @@ -205,6 +208,7 @@ private void UpdateApplyButton()
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);
Expand All @@ -221,6 +225,7 @@ private void UpdateApplyButton()
isHudThemeSame &&
isShowHeldItemSame &&
isCombatModeIndicatorsSame &&
isLoocShowSame &&
isFpsCounterVisibleSame &&
isWidthSame &&
isLayoutSame;
Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,9 @@ public static readonly CVarDef<bool>
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);

Expand Down
7 changes: 7 additions & 0 deletions Resources/Changelog/ChangelogADT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,10 @@ Entries:
id: 55603 #костыль отображения в Обновлениях
time: '2023-11-09T04:20:00.0000000+00:00'

- author: Шрёдингер
changes:
- {message: Изменил текст над головой при использовании LOOC чата., type: Fix}
- {message: Добавил возможно отключить LOOC чат над головой в настройках., type: Add}
id: 55605 #костыль отображения в Обновлениях
time: '2023-11-10T04:20:00.0000000+00:00'

1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/escape-menu/ui/options-menu.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ui-options-volume-percent = { TOSTRING($volume, "P0") }

ui-options-show-held-item = Показать удерживаемый элемент рядом с курсором?
ui-options-show-combat-mode-indicators = Показать индикатор боевого режима рядом с курсором?
ui-options-show-looc-on-head = Показывать LOOC чат над головой персонажей?
ui-options-vsync = Вертикальная синхронизация
ui-options-fullscreen = Полный экран
ui-options-lighting-label = Качество освещения:
Expand Down

0 comments on commit 328b577

Please sign in to comment.