Rainbow crayon + color-selectable crayons (#7786)
This commit is contained in:
@@ -40,6 +40,11 @@ namespace Content.Client.Crayon.UI
|
||||
SendMessage(new CrayonSelectMessage(state));
|
||||
}
|
||||
|
||||
public void SelectColor(string color)
|
||||
{
|
||||
SendMessage(new CrayonColorMessage(color));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
MinSize="250 300"
|
||||
SetSize="250 300">
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<ColorSelectorSliders Name="ColorSelector" Visible="False" />
|
||||
<LineEdit Name="Search" />
|
||||
<ScrollContainer VerticalExpand="True">
|
||||
<GridContainer Name="Grid" Columns="6">
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user