* removes transparency

* fit options
This commit is contained in:
Valtos
2024-04-23 00:50:07 +03:00
committed by GitHub
parent 9565de0262
commit 5d37092a0a
9 changed files with 17 additions and 89 deletions

View File

@@ -1,7 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:tabs="clr-namespace:Content.Client.Options.UI.Tabs"
Title="{Loc 'ui-options-title'}"
MinSize="980 500">
MinSize="980 580">
<TabContainer Name="Tabs" Access="Public">
<tabs:MiscTab Name="MiscTab" />
<tabs:GraphicsTab Name="GraphicsTab" />

View File

@@ -25,14 +25,6 @@
<CheckBox Name="ReducedMotionCheckBox" Text="{Loc 'ui-options-reduced-motion'}" />
<CheckBox Name="EnableColorNameCheckBox" Text="{Loc 'ui-options-enable-color-name'}" />
<CheckBox Name="ColorblindFriendlyCheckBox" Text="{Loc 'ui-options-colorblind-friendly'}" />
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ui-options-chat-window-opacity'}" Margin="8 0" />
<Slider Name="ChatWindowOpacitySlider"
MinValue="0"
MaxValue="1"
MinWidth="200" />
<Label Name="ChatWindowOpacityLabel" Margin="8 0" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ui-options-screen-shake-intensity'}" Margin="8 0" />
<Slider Name="ScreenShakeIntensitySlider"

View File

@@ -60,7 +60,7 @@ namespace Content.Client.Options.UI.Tabs
};
ShowOocPatronColor.Visible = _playerManager.LocalSession?.Channel.UserData.PatronTier is { } patron;
HudThemeOption.OnItemSelected += OnHudThemeChanged;
DiscordRich.OnToggled += OnCheckBoxToggled;
ShowOocPatronColor.OnToggled += OnCheckBoxToggled;
@@ -73,7 +73,6 @@ namespace Content.Client.Options.UI.Tabs
EnableColorNameCheckBox.OnToggled += OnCheckBoxToggled;
ColorblindFriendlyCheckBox.OnToggled += OnCheckBoxToggled;
ReducedMotionCheckBox.OnToggled += OnCheckBoxToggled;
ChatWindowOpacitySlider.OnValueChanged += OnChatWindowOpacitySliderChanged;
ScreenShakeIntensitySlider.OnValueChanged += OnScreenShakeIntensitySliderChanged;
// ToggleWalk.OnToggled += OnCheckBoxToggled;
StaticStorageUI.OnToggled += OnCheckBoxToggled;
@@ -90,7 +89,6 @@ namespace Content.Client.Options.UI.Tabs
EnableColorNameCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatEnableColorName);
ColorblindFriendlyCheckBox.Pressed = _cfg.GetCVar(CCVars.AccessibilityColorblindFriendly);
ReducedMotionCheckBox.Pressed = _cfg.GetCVar(CCVars.ReducedMotion);
ChatWindowOpacitySlider.Value = _cfg.GetCVar(CCVars.ChatWindowOpacity);
ScreenShakeIntensitySlider.Value = _cfg.GetCVar(CCVars.ScreenShakeIntensity) * 100f;
// ToggleWalk.Pressed = _cfg.GetCVar(CCVars.ToggleWalk);
StaticStorageUI.Pressed = _cfg.GetCVar(CCVars.StaticStorageUI);
@@ -111,13 +109,6 @@ namespace Content.Client.Options.UI.Tabs
UpdateApplyButton();
}
private void OnChatWindowOpacitySliderChanged(Range range)
{
ChatWindowOpacityLabel.Text = Loc.GetString("ui-options-chat-window-opacity-percent",
("opacity", range.Value));
UpdateApplyButton();
}
private void OnScreenShakeIntensitySliderChanged(Range obj)
{
ScreenShakeIntensityLabel.Text = Loc.GetString("ui-options-screen-shake-percent", ("intensity", ScreenShakeIntensitySlider.Value / 100f));
@@ -145,7 +136,6 @@ namespace Content.Client.Options.UI.Tabs
_cfg.SetCVar(CCVars.ChatEnableColorName, EnableColorNameCheckBox.Pressed);
_cfg.SetCVar(CCVars.AccessibilityColorblindFriendly, ColorblindFriendlyCheckBox.Pressed);
_cfg.SetCVar(CCVars.ReducedMotion, ReducedMotionCheckBox.Pressed);
_cfg.SetCVar(CCVars.ChatWindowOpacity, ChatWindowOpacitySlider.Value);
_cfg.SetCVar(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider.Value / 100f);
// _cfg.SetCVar(CCVars.ToggleWalk, ToggleWalk.Pressed);
_cfg.SetCVar(CCVars.StaticStorageUI, StaticStorageUI.Pressed);
@@ -174,7 +164,6 @@ namespace Content.Client.Options.UI.Tabs
var isEnableColorNameSame = EnableColorNameCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatEnableColorName);
var isColorblindFriendly = ColorblindFriendlyCheckBox.Pressed == _cfg.GetCVar(CCVars.AccessibilityColorblindFriendly);
var isReducedMotionSame = ReducedMotionCheckBox.Pressed == _cfg.GetCVar(CCVars.ReducedMotion);
var isChatWindowOpacitySame = Math.Abs(ChatWindowOpacitySlider.Value - _cfg.GetCVar(CCVars.ChatWindowOpacity)) < 0.01f;
var isScreenShakeIntensitySame = Math.Abs(ScreenShakeIntensitySlider.Value / 100f - _cfg.GetCVar(CCVars.ScreenShakeIntensity)) < 0.01f;
// var isToggleWalkSame = ToggleWalk.Pressed == _cfg.GetCVar(CCVars.ToggleWalk);
var isStaticStorageUISame = StaticStorageUI.Pressed == _cfg.GetCVar(CCVars.StaticStorageUI);
@@ -192,7 +181,6 @@ namespace Content.Client.Options.UI.Tabs
isEnableColorNameSame &&
isColorblindFriendly &&
isReducedMotionSame &&
isChatWindowOpacitySame &&
isScreenShakeIntensitySame &&
// isToggleWalkSame &&
isStaticStorageUISame;

View File

@@ -45,7 +45,6 @@ namespace Content.Client.Stylesheets
public const string StyleClassBorderedWindowPanel = "BorderedWindowPanel";
public const string StyleClassInventorySlotBackground = "InventorySlotBackground";
public const string StyleClassHandSlotHighlight = "HandSlotHighlight";
public const string StyleClassChatPanel = "ChatPanel";
public const string StyleClassChatSubPanel = "ChatSubPanel";
public const string StyleClassTransparentBorderedWindowPanel = "TransparentBorderedWindowPanel";
public const string StyleClassHotbarPanel = "HotbarPanel";
@@ -159,8 +158,6 @@ namespace Content.Client.Stylesheets
public const string StyleClassButtonColorGreen = "ButtonColorGreen";
public const string StyleClassButtonColorPurple = "ButtonColorPurple";
public static readonly Color ChatBackgroundColor = Color.FromHex("#25252ADD");
public override Stylesheet Stylesheet { get; }
public StyleNano(IResourceCache resCache) : base(resCache)
@@ -413,16 +410,12 @@ namespace Content.Client.Stylesheets
lineEdit.SetPatchMargin(StyleBox.Margin.All, 3);
lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5);
var chatBg = new StyleBoxFlat
var chatSubBgTex = resCache.GetTexture("/Textures/Interface/Nano/chat_sub_background.png");
var chatSubBg = new StyleBoxTexture
{
BackgroundColor = ChatBackgroundColor
Texture = chatSubBgTex,
};
var chatSubBg = new StyleBoxFlat
{
BackgroundColor = ChatBackgroundColor,
};
chatSubBg.SetContentMarginOverride(StyleBox.Margin.All, 3);
chatSubBg.SetPatchMargin(StyleBox.Margin.All, 2);
var actionSearchBoxTex = resCache.GetTexture("/Textures/Interface/Nano/black_panel_dark_thin_border.png");
var actionSearchBox = new StyleBoxTexture
@@ -974,13 +967,6 @@ namespace Content.Client.Stylesheets
Element<TextEdit>().Pseudo(TextEdit.StylePseudoClassPlaceholder)
.Prop("font-color", Color.Gray),
// chat subpanels (chat lineedit backing, popup backings)
new StyleRule(new SelectorElement(typeof(PanelContainer), new[] {StyleClassChatPanel}, null, null),
new[]
{
new StyleProperty(PanelContainer.StylePropertyPanel, chatBg),
}),
// Chat lineedit - we don't actually draw a stylebox around the lineedit itself, we put it around the
// input + other buttons, so we must clear the default stylebox
new StyleRule(new SelectorElement(typeof(LineEdit), new[] {StyleClassChatLineEdit}, null, null),
@@ -989,6 +975,13 @@ namespace Content.Client.Stylesheets
new StyleProperty(LineEdit.StylePropertyStyleBox, new StyleBoxEmpty()),
}),
// chat subpanels (chat lineedit backing, popup backings)
new StyleRule(new SelectorElement(typeof(PanelContainer), new[] {StyleClassChatSubPanel}, null, null),
new[]
{
new StyleProperty(PanelContainer.StylePropertyPanel, chatSubBg),
}),
// Action searchbox lineedit
new StyleRule(new SelectorElement(typeof(LineEdit), new[] {StyleClassActionSearchBox}, null, null),
new[]

View File

@@ -8,7 +8,6 @@ using Content.Client.Chat.UI;
using Content.Client.Examine;
using Content.Client.Gameplay;
using Content.Client.Ghost;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Screens;
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Content.Client.UserInterface.Systems.Gameplay;
@@ -251,9 +250,6 @@ public sealed class ChatUIController : UIController
{
_chatNameColors[i] = nameColors[i].ToHex();
}
_config.OnValueChanged(CCVars.ChatWindowOpacity, OnChatWindowOpacityChanged);
}
private void OnUpdateChangelingChat(ChangelingUserStart ev)
@@ -274,8 +270,6 @@ public sealed class ChatUIController : UIController
var viewportContainer = UIManager.ActiveScreen!.FindControl<LayoutContainer>("ViewportContainer");
SetSpeechBubbleRoot(viewportContainer);
SetChatWindowOpacity(_config.GetCVar(CCVars.ChatWindowOpacity));
}
public void OnScreenUnload()
@@ -283,34 +277,6 @@ public sealed class ChatUIController : UIController
SetMainChat(false);
}
private void OnChatWindowOpacityChanged(float opacity)
{
SetChatWindowOpacity(opacity);
}
private void SetChatWindowOpacity(float opacity)
{
var chatBox = UIManager.ActiveScreen?.GetWidget<ChatBox>() ?? UIManager.ActiveScreen?.GetWidget<ResizableChatBox>();
var panel = chatBox?.ChatWindowPanel;
if (panel is null)
return;
Color color;
if (panel.PanelOverride is StyleBoxFlat styleBoxFlat)
color = styleBoxFlat.BackgroundColor;
else if (panel.TryGetStyleProperty<StyleBox>(PanelContainer.StylePropertyPanel, out var style)
&& style is StyleBoxFlat propStyleBoxFlat)
color = propStyleBoxFlat.BackgroundColor;
else
color = StyleNano.ChatBackgroundColor;
panel.PanelOverride = new StyleBoxFlat
{
BackgroundColor = color.WithAlpha(opacity)
};
}
public void SetMainChat(bool setting)
{
if (UIManager.ActiveScreen == null)

View File

@@ -1,5 +1,4 @@
using Content.Client.Stylesheets;
using Content.Shared.Chat;
using Content.Shared.Chat;
using Content.Shared.Input;
using Robust.Client.UserInterface.Controls;
@@ -45,7 +44,6 @@ public class ChatInputBox : PanelContainer
StyleClasses = {"chatFilterOptionButton"}
};
Container.AddChild(FilterButton);
AddStyleClass(StyleNano.StyleClassChatSubPanel);
ChannelSelector.OnChannelSelect += UpdateActiveChannel;
}

View File

@@ -8,7 +8,7 @@
VerticalExpand="True"
MinSize="465 225">
<PanelContainer Name="ChatWindowPanel" Access="Public" HorizontalExpand="True" VerticalExpand="True"
StyleClasses="StyleNano.StyleClassChatPanel">
StyleClasses="FuckyWuckyBackground">
<BoxContainer Orientation="Vertical" SeparationOverride="4" HorizontalExpand="True" VerticalExpand="True">
<OutputPanel Name="Contents" HorizontalExpand="True" VerticalExpand="True" Margin="2 2 2 2" >
<OutputPanel.StyleBoxOverride>

View File

@@ -726,7 +726,7 @@ namespace Content.Shared.CCVar
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", false, CVar.ARCHIVE | CVar.CLIENTONLY);
@@ -1225,7 +1225,7 @@ namespace Content.Shared.CCVar
/// </summary>
public static readonly CVarDef<bool> OocEnableDuringRound =
CVarDef.Create("ooc.enable_during_round", false, CVar.NOTIFY | CVar.REPLICATED | CVar.SERVER);
public static readonly CVarDef<bool> ShowOocPatronColor =
CVarDef.Create("ooc.show_ooc_patron_color", true, CVar.ARCHIVE | CVar.REPLICATED | CVar.CLIENT);
@@ -1590,13 +1590,6 @@ namespace Content.Shared.CCVar
* Accessibility
*/
/// <summary>
/// Chat window opacity slider, controlling the alpha of the chat window background.
/// Goes from to 0 (completely transparent) to 1 (completely opaque)
/// </summary>
public static readonly CVarDef<float> ChatWindowOpacity =
CVarDef.Create("accessibility.chat_window_transparency", 0.85f, CVar.CLIENTONLY | CVar.ARCHIVE);
/// <summary>
/// Toggle for visual effects that may potentially cause motion sickness.
/// Where reasonable, effects affected by this CVar should use an alternate effect.

View File

@@ -49,8 +49,6 @@ ui-options-fancy-name-background = Add background to speech bubble names
ui-options-enable-color-name = Add colors to character names
ui-options-colorblind-friendly = Colorblind friendly mode
ui-options-reduced-motion = Reduce motion of visual effects
ui-options-chat-window-opacity = Chat window opacity
ui-options-chat-window-opacity-percent = { TOSTRING($opacity, "P0") }
ui-options-screen-shake-intensity = Screen shake intensity
ui-options-screen-shake-percent = { TOSTRING($intensity, "P0") }
ui-options-vsync = VSync