Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Jabak
2024-06-04 14:07:10 +03:00
22 changed files with 141 additions and 42 deletions

View File

@@ -40,6 +40,7 @@
<CheckBox Name="ParallaxLowQualityCheckBox" Text="{Loc 'ui-options-parallax-low-quality'}" />
<CheckBox Name="FpsCounterCheckBox" Text="{Loc 'ui-options-fps-counter'}" />
<CheckBox Name="LogInChatCheckBox" Text="Логировать действия в чат" />
<CheckBox Name="ShowTrailsCheckBox" Text="Отображать трейлы от пуль" />
</BoxContainer>
<controls:StripeBack HasBottomEdge="False" HasMargins="False">
<Button Name="ApplyButton"

View File

@@ -74,6 +74,7 @@ namespace Content.Client.Options.UI.Tabs
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
FpsCounterCheckBox.OnToggled += OnCheckBoxToggled;
LogInChatCheckBox.OnToggled += OnCheckBoxToggled;
ShowTrailsCheckBox.OnToggled += OnCheckBoxToggled;
ApplyButton.OnPressed += OnApplyButtonPressed;
VSyncCheckBox.Pressed = _cfg.GetCVar(CVars.DisplayVSync);
FullscreenCheckBox.Pressed = ConfigIsFullscreen;
@@ -86,6 +87,7 @@ namespace Content.Client.Options.UI.Tabs
ParallaxLowQualityCheckBox.Pressed = _cfg.GetCVar(CCVars.ParallaxLowQuality);
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
LogInChatCheckBox.Pressed = _cfg.GetCVar(WhiteCVars.LogChatActions);
ShowTrailsCheckBox.Pressed = _cfg.GetCVar(WhiteCVars.ShowTrails);
ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);
_cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
@@ -119,6 +121,7 @@ namespace Content.Client.Options.UI.Tabs
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
_cfg.SetCVar(WhiteCVars.LogChatActions, LogInChatCheckBox.Pressed);
_cfg.SetCVar(WhiteCVars.ShowTrails, ShowTrailsCheckBox.Pressed);
_cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);
_cfg.SaveToFile();
@@ -149,6 +152,7 @@ namespace Content.Client.Options.UI.Tabs
var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
var isLogInChatSame = LogInChatCheckBox.Pressed == _cfg.GetCVar(WhiteCVars.LogChatActions);
var isShowTrailsSame = ShowTrailsCheckBox.Pressed == _cfg.GetCVar(WhiteCVars.ShowTrails);
var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
ApplyButton.Disabled = isVSyncSame &&
@@ -162,7 +166,8 @@ namespace Content.Client.Options.UI.Tabs
isPLQSame &&
isFpsCounterVisibleSame &&
isWidthSame &&
isLogInChatSame;
isLogInChatSame &&
isShowTrailsSame;
}
private bool ConfigIsFullscreen =>

View File

@@ -1,6 +1,8 @@
using Content.Client._White.Trail.Line.Manager;
using Content.Shared._White;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
@@ -11,6 +13,9 @@ public sealed class TrailOverlay : Overlay
private readonly IPrototypeManager _protoManager;
private readonly IResourceCache _cache;
private readonly ITrailLineManager _lineManager;
private readonly IConfigurationManager _cfg;
private bool _showTrails;
private readonly Dictionary<string, ShaderInstance?> _shaderDict;
private readonly Dictionary<string, Texture?> _textureDict;
@@ -20,13 +25,17 @@ public sealed class TrailOverlay : Overlay
public TrailOverlay(
IPrototypeManager protoManager,
IResourceCache cache,
IConfigurationManager cfg,
ITrailLineManager lineManager
)
{
_protoManager = protoManager;
_cache = cache;
_cfg = cfg;
_lineManager = lineManager;
_cfg.OnValueChanged(WhiteCVars.ShowTrails, val => _showTrails = val, true);
_shaderDict = new Dictionary<string, ShaderInstance?>();
_textureDict = new Dictionary<string, Texture?>();
@@ -38,6 +47,9 @@ public sealed class TrailOverlay : Overlay
var handle = args.WorldHandle;
foreach (var item in _lineManager.Lines)
{
if (!_showTrails && item.Settings.OptionsConcealable)
continue;
item.Render(handle, GetCachedTexture(item.Settings.TexurePath ?? ""));
}
}

View File

@@ -2,6 +2,7 @@ using Content.Client._White.Trail.Line.Manager;
using Content.Shared._White.Trail;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Configuration;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
@@ -23,6 +24,7 @@ public sealed class TrailSystem : EntitySystem
new TrailOverlay(
IoCManager.Resolve<IPrototypeManager>(),
IoCManager.Resolve<IResourceCache>(),
IoCManager.Resolve<IConfigurationManager>(),
_lineManager
));