mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-04 05:17:28 +00:00
* Merge pull request impstation/imp-station-14#468 from hivehum/highlight Add text highlighting (cherry picked from commit e442cc4bb20fbb4d5b970275c82cc87508e6f687) * More cleanly separate auto-generated and manual highlights Edge case that's not handled: Closing and reopening the game drops the list of auto-generated highlights * Use LocalizedDatasets to make higlight lists for all jobs * DeltaV-ification Since the implementation is now fundamentally incompatible with the (still open) upstream PR, move to our own cvars * Try to untroll code * Untroll * Untroll for real this time * Fix wrong count in ChatHighlightBorg * Escape highlights Depends on space-wizards/RobustToolbox/pull/5688 * add missing using directive * Fix failing test * Rename CVars to avoid clash with previous implementation * Tidy some stuff up * Show auto highlights * Remove redundant check --------- Co-authored-by: V <97265903+formlessnameless@users.noreply.github.com>
57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using Content.Client.Options.UI;
|
|
using Robust.Shared.Configuration;
|
|
|
|
namespace Content.Client._DV.Options.UI;
|
|
|
|
/// <summary>
|
|
/// 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();
|
|
}
|
|
}
|
|
|
|
/// <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();
|
|
};
|
|
}
|
|
|
|
private void UpdateLabelColor()
|
|
{
|
|
_slider.ExampleLabel.FontColorOverride = Color.FromHex(Value);
|
|
}
|
|
}
|