Rainbow crayon + color-selectable crayons (#7786)

This commit is contained in:
Flipp Syder
2022-04-28 05:23:45 -07:00
committed by GitHub
parent 4c9e45a480
commit 2325a7df94
9 changed files with 105 additions and 3 deletions

View File

@@ -30,6 +30,16 @@ namespace Content.Client.Crayon.UI
Owner = owner;
Search.OnTextChanged += _ => RefreshList();
ColorSelector.OnColorChanged += SelectColor;
}
private void SelectColor(Color color)
{
_color = color;
Owner.SelectColor(color.ToHex());
RefreshList();
}
private void RefreshList()
@@ -86,7 +96,14 @@ namespace Content.Client.Crayon.UI
public void UpdateState(CrayonBoundUserInterfaceState state)
{
_selected = state.Selected;
ColorSelector.Visible = state.SelectableColor;
_color = state.Color;
if (ColorSelector.Visible)
{
ColorSelector.Color = state.Color;
}
RefreshList();
}