Adds new speech bubble opacity sliders to the accessibility menu. (#35346)
* Adds new accessibility slider for speech bubble text opacity. Adds new accessibility slider for speech bubble background opacity. Adds new Cvars to track speech bubble text and background opacity settings. * Adds a separate option slider for the opacity of the speaker's name on speech bubbles. * Changes text and speaker default opacity to 100%, as it was before. * Apply suggestions from code review --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -217,7 +217,7 @@ namespace Content.Client.Chat.UI
|
|||||||
{
|
{
|
||||||
StyleClasses = { "speechBox", speechStyleClass },
|
StyleClasses = { "speechBox", speechStyleClass },
|
||||||
Children = { label },
|
Children = { label },
|
||||||
ModulateSelfOverride = Color.White.WithAlpha(0.75f)
|
ModulateSelfOverride = Color.White.WithAlpha(ConfigManager.GetCVar(CCVars.SpeechBubbleBackgroundOpacity))
|
||||||
};
|
};
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
@@ -247,21 +247,23 @@ namespace Content.Client.Chat.UI
|
|||||||
{
|
{
|
||||||
StyleClasses = { "speechBox", speechStyleClass },
|
StyleClasses = { "speechBox", speechStyleClass },
|
||||||
Children = { label },
|
Children = { label },
|
||||||
ModulateSelfOverride = Color.White.WithAlpha(0.75f)
|
ModulateSelfOverride = Color.White.WithAlpha(ConfigManager.GetCVar(CCVars.SpeechBubbleBackgroundOpacity)),
|
||||||
};
|
};
|
||||||
return unfanciedPanel;
|
return unfanciedPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bubbleHeader = new RichTextLabel
|
var bubbleHeader = new RichTextLabel
|
||||||
{
|
{
|
||||||
Margin = new Thickness(1, 1, 1, 1)
|
ModulateSelfOverride = Color.White.WithAlpha(ConfigManager.GetCVar(CCVars.SpeechBubbleSpeakerOpacity)),
|
||||||
|
Margin = new Thickness(1, 1, 1, 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
var bubbleContent = new RichTextLabel
|
var bubbleContent = new RichTextLabel
|
||||||
{
|
{
|
||||||
|
ModulateSelfOverride = Color.White.WithAlpha(ConfigManager.GetCVar(CCVars.SpeechBubbleTextOpacity)),
|
||||||
MaxWidth = SpeechMaxWidth,
|
MaxWidth = SpeechMaxWidth,
|
||||||
Margin = new Thickness(2, 6, 2, 2),
|
Margin = new Thickness(2, 6, 2, 2),
|
||||||
StyleClasses = { "bubbleContent" }
|
StyleClasses = { "bubbleContent" },
|
||||||
};
|
};
|
||||||
|
|
||||||
//We'll be honest. *Yes* this is hacky. Doing this in a cleaner way would require a bottom-up refactor of how saycode handles sending chat messages. -Myr
|
//We'll be honest. *Yes* this is hacky. Doing this in a cleaner way would require a bottom-up refactor of how saycode handles sending chat messages. -Myr
|
||||||
@@ -273,7 +275,7 @@ namespace Content.Client.Chat.UI
|
|||||||
{
|
{
|
||||||
StyleClasses = { "speechBox", speechStyleClass },
|
StyleClasses = { "speechBox", speechStyleClass },
|
||||||
Children = { bubbleContent },
|
Children = { bubbleContent },
|
||||||
ModulateSelfOverride = Color.White.WithAlpha(0.75f),
|
ModulateSelfOverride = Color.White.WithAlpha(ConfigManager.GetCVar(CCVars.SpeechBubbleBackgroundOpacity)),
|
||||||
HorizontalAlignment = HAlignment.Center,
|
HorizontalAlignment = HAlignment.Center,
|
||||||
VerticalAlignment = VAlignment.Bottom,
|
VerticalAlignment = VAlignment.Bottom,
|
||||||
Margin = new Thickness(4, 14, 4, 2)
|
Margin = new Thickness(4, 14, 4, 2)
|
||||||
@@ -283,7 +285,7 @@ namespace Content.Client.Chat.UI
|
|||||||
{
|
{
|
||||||
StyleClasses = { "speechBox", speechStyleClass },
|
StyleClasses = { "speechBox", speechStyleClass },
|
||||||
Children = { bubbleHeader },
|
Children = { bubbleHeader },
|
||||||
ModulateSelfOverride = Color.White.WithAlpha(ConfigManager.GetCVar(CCVars.ChatFancyNameBackground) ? 0.75f : 0f),
|
ModulateSelfOverride = Color.White.WithAlpha(ConfigManager.GetCVar(CCVars.ChatFancyNameBackground) ? ConfigManager.GetCVar(CCVars.SpeechBubbleBackgroundOpacity) : 0f),
|
||||||
HorizontalAlignment = HAlignment.Center,
|
HorizontalAlignment = HAlignment.Center,
|
||||||
VerticalAlignment = VAlignment.Top
|
VerticalAlignment = VAlignment.Top
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,8 +7,11 @@
|
|||||||
<CheckBox Name="ReducedMotionCheckBox" Text="{Loc 'ui-options-reduced-motion'}" />
|
<CheckBox Name="ReducedMotionCheckBox" Text="{Loc 'ui-options-reduced-motion'}" />
|
||||||
<CheckBox Name="EnableColorNameCheckBox" Text="{Loc 'ui-options-enable-color-name'}" />
|
<CheckBox Name="EnableColorNameCheckBox" Text="{Loc 'ui-options-enable-color-name'}" />
|
||||||
<CheckBox Name="ColorblindFriendlyCheckBox" Text="{Loc 'ui-options-colorblind-friendly'}" />
|
<CheckBox Name="ColorblindFriendlyCheckBox" Text="{Loc 'ui-options-colorblind-friendly'}" />
|
||||||
<ui:OptionSlider Name="ChatWindowOpacitySlider" Title="{Loc 'ui-options-chat-window-opacity'}" />
|
|
||||||
<ui:OptionSlider Name="ScreenShakeIntensitySlider" Title="{Loc 'ui-options-screen-shake-intensity'}" />
|
<ui:OptionSlider Name="ScreenShakeIntensitySlider" Title="{Loc 'ui-options-screen-shake-intensity'}" />
|
||||||
|
<ui:OptionSlider Name="ChatWindowOpacitySlider" Title="{Loc 'ui-options-chat-window-opacity'}" />
|
||||||
|
<ui:OptionSlider Name="SpeechBubbleTextOpacitySlider" Title="{Loc 'ui-options-speech-bubble-text-opacity'}" />
|
||||||
|
<ui:OptionSlider Name="SpeechBubbleSpeakerOpacitySlider" Title="{Loc 'ui-options-speech-bubble-speaker-opacity'}" />
|
||||||
|
<ui:OptionSlider Name="SpeechBubbleBackgroundOpacitySlider" Title="{Loc 'ui-options-speech-bubble-background-opacity'}" />
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
</ScrollContainer>
|
</ScrollContainer>
|
||||||
<ui:OptionsTabControlRow Name="Control" Access="Public" />
|
<ui:OptionsTabControlRow Name="Control" Access="Public" />
|
||||||
|
|||||||
@@ -15,8 +15,11 @@ public sealed partial class AccessibilityTab : Control
|
|||||||
Control.AddOptionCheckBox(CCVars.ChatEnableColorName, EnableColorNameCheckBox);
|
Control.AddOptionCheckBox(CCVars.ChatEnableColorName, EnableColorNameCheckBox);
|
||||||
Control.AddOptionCheckBox(CCVars.AccessibilityColorblindFriendly, ColorblindFriendlyCheckBox);
|
Control.AddOptionCheckBox(CCVars.AccessibilityColorblindFriendly, ColorblindFriendlyCheckBox);
|
||||||
Control.AddOptionCheckBox(CCVars.ReducedMotion, ReducedMotionCheckBox);
|
Control.AddOptionCheckBox(CCVars.ReducedMotion, ReducedMotionCheckBox);
|
||||||
Control.AddOptionPercentSlider(CCVars.ChatWindowOpacity, ChatWindowOpacitySlider);
|
|
||||||
Control.AddOptionPercentSlider(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider);
|
Control.AddOptionPercentSlider(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider);
|
||||||
|
Control.AddOptionPercentSlider(CCVars.ChatWindowOpacity, ChatWindowOpacitySlider);
|
||||||
|
Control.AddOptionPercentSlider(CCVars.SpeechBubbleTextOpacity, SpeechBubbleTextOpacitySlider);
|
||||||
|
Control.AddOptionPercentSlider(CCVars.SpeechBubbleSpeakerOpacity, SpeechBubbleSpeakerOpacitySlider);
|
||||||
|
Control.AddOptionPercentSlider(CCVars.SpeechBubbleBackgroundOpacity, SpeechBubbleBackgroundOpacitySlider);
|
||||||
|
|
||||||
Control.Initialize();
|
Control.Initialize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,27 @@ public sealed partial class CCVars
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly CVarDef<bool> AccessibilityColorblindFriendly =
|
public static readonly CVarDef<bool> AccessibilityColorblindFriendly =
|
||||||
CVarDef.Create("accessibility.colorblind_friendly", false, CVar.CLIENTONLY | CVar.ARCHIVE);
|
CVarDef.Create("accessibility.colorblind_friendly", false, CVar.CLIENTONLY | CVar.ARCHIVE);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Speech bubble text opacity slider, controlling the alpha of speech bubble's text.
|
||||||
|
/// Goes from to 0 (completely transparent) to 1 (completely opaque)
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<float> SpeechBubbleTextOpacity =
|
||||||
|
CVarDef.Create("accessibility.speech_bubble_text_opacity", 1f, CVar.CLIENTONLY | CVar.ARCHIVE);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Speech bubble speaker opacity slider, controlling the alpha of the speaker's name in a speech bubble.
|
||||||
|
/// Goes from to 0 (completely transparent) to 1 (completely opaque)
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<float> SpeechBubbleSpeakerOpacity =
|
||||||
|
CVarDef.Create("accessibility.speech_bubble_speaker_opacity", 1f, CVar.CLIENTONLY | CVar.ARCHIVE);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Speech bubble background opacity slider, controlling the alpha of the speech bubble's background.
|
||||||
|
/// Goes from to 0 (completely transparent) to 1 (completely opaque)
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<float> SpeechBubbleBackgroundOpacity =
|
||||||
|
CVarDef.Create("accessibility.speech_bubble_background_opacity", 0.75f, CVar.CLIENTONLY | CVar.ARCHIVE);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,5 +281,8 @@ cmd-options-help = Usage: options [tab]
|
|||||||
ui-options-enable-color-name = Add colors to character names
|
ui-options-enable-color-name = Add colors to character names
|
||||||
ui-options-colorblind-friendly = Colorblind friendly mode
|
ui-options-colorblind-friendly = Colorblind friendly mode
|
||||||
ui-options-reduced-motion = Reduce motion of visual effects
|
ui-options-reduced-motion = Reduce motion of visual effects
|
||||||
ui-options-chat-window-opacity = Chat window opacity
|
|
||||||
ui-options-screen-shake-intensity = Screen shake intensity
|
ui-options-screen-shake-intensity = Screen shake intensity
|
||||||
|
ui-options-chat-window-opacity = Chat window opacity
|
||||||
|
ui-options-speech-bubble-text-opacity = Speech bubble text opacity
|
||||||
|
ui-options-speech-bubble-speaker-opacity = Speech bubble speaker opacity
|
||||||
|
ui-options-speech-bubble-background-opacity = Speech bubble background opacity
|
||||||
Reference in New Issue
Block a user