-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Подсветка текста в фильтрах QOL #14
Changes from all commits
f6ab374
7104d66
3a548df
740b1b4
8e30fcc
d9ed746
278ddb9
585a4be
96aeabd
b62c91f
4db8eaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System.Linq; | ||
using Content.Client._CorvaxNext.Options.UI; | ||
using Content.Client.Stylesheets; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface; | ||
|
@@ -120,6 +121,21 @@ public OptionSliderFloatCVar AddOptionPercentSlider( | |
{ | ||
return AddOption(new OptionSliderFloatCVar(this, _cfg, cVar, slider, min, max, scale, FormatPercent)); | ||
} | ||
|
||
// Corvax-Highlights-Start | ||
/// <summary> | ||
/// Add a color slider option, backed by a simple string CVar. | ||
/// </summary> | ||
/// <param name="cVar">The CVar represented by the slider.</param> | ||
/// <param name="slider">The UI control for the option.</param> | ||
/// <returns>The option instance backing the added option.</returns> | ||
public OptionColorSliderCVar AddOptionColorSlider( | ||
CVarDef<string> cVar, | ||
OptionColorSlider slider) | ||
{ | ||
return AddOption(new OptionColorSliderCVar(this, _cfg, cVar, slider)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. в Corvax CVars |
||
} | ||
// Corvax-Highlights-End | ||
|
||
/// <summary> | ||
/// Add a slider option, backed by a simple integer CVar. | ||
|
@@ -518,6 +534,60 @@ private void UpdateLabelValue() | |
} | ||
} | ||
|
||
/// <summary> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. закрой тэгами корвакса |
||
/// Implementation of a CVar option that simply corresponds with a string <see cref="OptionColorSlider"/>. | ||
/// </summary> | ||
/// <seealso cref="OptionsTabControlRow"/> | ||
public sealed class OptionColorSliderCVar : BaseOptionCVar<string> | ||
{ | ||
private readonly OptionColorSlider _slider; | ||
|
||
protected override string Value | ||
{ | ||
get => _slider.Slider.Color.ToHex(); | ||
set | ||
{ | ||
_slider.Slider.Color = Color.FromHex(value); | ||
UpdateLabelColor(); | ||
} | ||
} | ||
|
||
// Corvax-Highlights-Start | ||
/// <summary> | ||
/// Creates a new instance of this type. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// It is generally more convenient to call overloads on <see cref="OptionsTabControlRow"/> | ||
/// such as <see cref="OptionsTabControlRow.AddOptionPercentSlider"/> instead of instantiating this type directly. | ||
/// </para> | ||
/// </remarks> | ||
/// <param name="controller">The control row that owns this option.</param> | ||
/// <param name="cfg">The configuration manager to get and set values from.</param> | ||
/// <param name="cVar">The CVar that is being controlled by this option.</param> | ||
/// <param name="slider">The UI control for the option.</param> | ||
public OptionColorSliderCVar( | ||
OptionsTabControlRow controller, | ||
IConfigurationManager cfg, | ||
CVarDef<string> cVar, | ||
OptionColorSlider slider) : base(controller, cfg, cVar) | ||
{ | ||
_slider = slider; | ||
|
||
slider.Slider.OnColorChanged += _ => | ||
{ | ||
ValueChanged(); | ||
UpdateLabelColor(); | ||
}; | ||
} | ||
// Corvax-Highlights-End | ||
|
||
private void UpdateLabelColor() | ||
{ | ||
_slider.ExampleLabel.FontColorOverride = Color.FromHex(Value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Implementation of a CVar option that simply corresponds with an integer <see cref="OptionSlider"/>. | ||
/// </summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<Control xmlns="https://spacestation14.io" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:ui="clr-namespace:Content.Client.Options.UI"> | ||
xmlns:ui="clr-namespace:Content.Client.Options.UI" | ||
xmlns:cnui="clr-namespace:Content.Client._CorvaxNext.Options.UI"> | ||
<BoxContainer Orientation="Vertical"> | ||
<ScrollContainer VerticalExpand="True" HScrollEnabled="False"> | ||
<BoxContainer Orientation="Vertical" Margin="8"> | ||
|
@@ -9,6 +10,12 @@ | |
<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'}" /> | ||
<!-- Corvax-Highlights-Start --> | ||
<CheckBox Name="AutoFillHighlightsCheckBox" Text="{Loc 'ui-options-auto-fill-highlights'}" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. закрой тэгами корвакса |
||
<cnui:OptionColorSlider Name="HighlightsColorSlider" | ||
Title="{Loc 'ui-options-highlights-color'}" | ||
Example="{Loc 'ui-options-highlights-color-example'}"/> | ||
<!-- Corvax-Highlights-End --> | ||
</BoxContainer> | ||
</ScrollContainer> | ||
<ui:OptionsTabControlRow Name="Control" Access="Public" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
<controls:ChannelFilterPopup | ||
xmlns="https://spacestation14.io" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. закрывай изменения тэгами корвакса |
||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Systems.Chat.Controls"> | ||
<PanelContainer Name="FilterPopupPanel" StyleClasses="BorderedWindowPanel"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Control MinSize="4 0"/> | ||
<BoxContainer Name="FilterVBox" MinWidth="110" Margin="0 10" Orientation="Vertical" SeparationOverride="4"/> | ||
<!-- Corvax-Highlights-Start --> | ||
<BoxContainer Orientation="Horizontal" SeparationOverride="8" Margin="10 0"> | ||
<BoxContainer Name="FilterVBox" MinWidth="105" Margin="0 10" Orientation="Vertical" SeparationOverride="4"/> | ||
<BoxContainer Name="HighlightsVBox" MinWidth="120" Margin="0 10" Orientation="Vertical" SeparationOverride="4"> | ||
<Label Text="{Loc 'hud-chatbox-highlights'}"/> | ||
<!-- Custom background for the TextEdit --> | ||
<PanelContainer> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#323446"/> | ||
</PanelContainer.PanelOverride> | ||
<TextEdit Name="HighlightEdit" MinHeight="150" Margin="5 5"/> | ||
</PanelContainer> | ||
<Button Name="HighlightButton" Text="{Loc 'hud-chatbox-highlights-button'}" ToolTip="{Loc 'hud-chatbox-highlights-tooltip'}"/> | ||
</BoxContainer> | ||
<!-- Corvax-Highlights-End --> | ||
</BoxContainer> | ||
</PanelContainer> | ||
</controls:ChannelFilterPopup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
закрой тэгами по типу // Corvax-Highlights-Start // Corvax-Highlights-End // Corvax-Highlights