Restores the palette picker in decals (#7635)
This commit is contained in:
@@ -11,7 +11,10 @@
|
||||
</GridContainer>
|
||||
</ScrollContainer>
|
||||
|
||||
<ColorSelectorSliders Name="ColorPicker" IsAlphaVisible="True" />
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<ColorSelectorSliders Name="ColorPicker" IsAlphaVisible="True" />
|
||||
<Button Name="PickerOpen" Text="{Loc 'decal-placer-window-palette'}" />
|
||||
</BoxContainer>
|
||||
<CheckBox Name="EnableColor" Text="{Loc 'decal-placer-window-use-color'}" />
|
||||
<CheckBox Name="EnableSnap" Text="{Loc 'decal-placer-window-enable-snap'}" />
|
||||
<CheckBox Name="EnableCleanable" Text="{Loc 'decal-placer-window-enable-cleanable'}" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.Stylesheets;
|
||||
using System.Linq;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.Decals;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -19,6 +20,8 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
|
||||
|
||||
public FloatSpinBox RotationSpinBox;
|
||||
|
||||
private PaletteColorPicker? _picker;
|
||||
|
||||
private Dictionary<string, Texture>? _decals;
|
||||
private string? _selected;
|
||||
private Color _color = Color.White;
|
||||
@@ -44,12 +47,34 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
|
||||
SpinBoxContainer.AddChild(RotationSpinBox);
|
||||
|
||||
Search.OnTextChanged += _ => RefreshList();
|
||||
ColorPicker.OnColorChanged += color =>
|
||||
ColorPicker.OnColorChanged += OnColorPicked;
|
||||
|
||||
PickerOpen.OnPressed += _ =>
|
||||
{
|
||||
_color = color;
|
||||
UpdateDecalPlacementInfo();
|
||||
RefreshList();
|
||||
if (_picker is null)
|
||||
{
|
||||
_picker = new PaletteColorPicker();
|
||||
_picker.OpenToLeft();
|
||||
_picker.PaletteList.OnItemSelected += args =>
|
||||
{
|
||||
var color = (args.ItemList.GetSelected().First().Metadata as Color?)!.Value;
|
||||
ColorPicker.Color = color;
|
||||
OnColorPicked(color);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_picker.IsOpen)
|
||||
{
|
||||
_picker.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
_picker.Open();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RotationSpinBox.OnValueChanged += args =>
|
||||
{
|
||||
_rotation = args.Value;
|
||||
@@ -77,6 +102,13 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
|
||||
Populate();
|
||||
}
|
||||
|
||||
private void OnColorPicked(Color color)
|
||||
{
|
||||
_color = color;
|
||||
UpdateDecalPlacementInfo();
|
||||
RefreshList();
|
||||
}
|
||||
|
||||
private void UpdateDecalPlacementInfo()
|
||||
{
|
||||
if (_selected is null)
|
||||
|
||||
Reference in New Issue
Block a user