Reapply "Remove some BUI boilerplate" (#30214) (#30219)

* Reapply "Remove some BUI boilerplate" (#30214)

This reverts commit cb0ba66be3.

* Fix gas tank

* Fix PA

* Fix microwave

* Comms console underwrap

* Fix rcd

* log wehs
This commit is contained in:
metalgearsloth
2024-07-21 14:48:13 +10:00
committed by GitHub
parent 87e52e50b4
commit edb05e36bb
137 changed files with 1102 additions and 1757 deletions

View File

@@ -18,18 +18,17 @@ namespace Content.Client.Crayon.UI
[GenerateTypedNameReferences]
public sealed partial class CrayonWindow : DefaultWindow
{
public CrayonBoundUserInterface Owner { get; }
private Dictionary<string, Texture>? _decals;
private string? _selected;
private Color _color;
public CrayonWindow(CrayonBoundUserInterface owner)
public event Action<Color>? OnColorSelected;
public event Action<string>? OnSelected;
public CrayonWindow()
{
RobustXamlLoader.Load(this);
Owner = owner;
Search.OnTextChanged += _ => RefreshList();
ColorSelector.OnColorChanged += SelectColor;
}
@@ -38,16 +37,16 @@ namespace Content.Client.Crayon.UI
{
_color = color;
Owner.SelectColor(color);
OnColorSelected?.Invoke(color);
RefreshList();
}
private void RefreshList()
{
// Clear
Grid.RemoveAllChildren();
if (_decals == null) return;
Grid.DisposeAllChildren();
if (_decals == null)
return;
var filter = Search.Text;
foreach (var (decal, tex) in _decals)
@@ -89,7 +88,6 @@ namespace Content.Client.Crayon.UI
{
if (obj.Button.Name == null) return;
Owner.Select(obj.Button.Name);
_selected = obj.Button.Name;
RefreshList();
}