Restores the palette picker in decals (#7635)
This commit is contained in:
@@ -11,7 +11,10 @@
|
|||||||
</GridContainer>
|
</GridContainer>
|
||||||
</ScrollContainer>
|
</ScrollContainer>
|
||||||
|
|
||||||
|
<BoxContainer Orientation="Vertical">
|
||||||
<ColorSelectorSliders Name="ColorPicker" IsAlphaVisible="True" />
|
<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="EnableColor" Text="{Loc 'decal-placer-window-use-color'}" />
|
||||||
<CheckBox Name="EnableSnap" Text="{Loc 'decal-placer-window-enable-snap'}" />
|
<CheckBox Name="EnableSnap" Text="{Loc 'decal-placer-window-enable-snap'}" />
|
||||||
<CheckBox Name="EnableCleanable" Text="{Loc 'decal-placer-window-enable-cleanable'}" />
|
<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 Content.Shared.Decals;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
@@ -19,6 +20,8 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
|
|||||||
|
|
||||||
public FloatSpinBox RotationSpinBox;
|
public FloatSpinBox RotationSpinBox;
|
||||||
|
|
||||||
|
private PaletteColorPicker? _picker;
|
||||||
|
|
||||||
private Dictionary<string, Texture>? _decals;
|
private Dictionary<string, Texture>? _decals;
|
||||||
private string? _selected;
|
private string? _selected;
|
||||||
private Color _color = Color.White;
|
private Color _color = Color.White;
|
||||||
@@ -44,12 +47,34 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
|
|||||||
SpinBoxContainer.AddChild(RotationSpinBox);
|
SpinBoxContainer.AddChild(RotationSpinBox);
|
||||||
|
|
||||||
Search.OnTextChanged += _ => RefreshList();
|
Search.OnTextChanged += _ => RefreshList();
|
||||||
ColorPicker.OnColorChanged += color =>
|
ColorPicker.OnColorChanged += OnColorPicked;
|
||||||
|
|
||||||
|
PickerOpen.OnPressed += _ =>
|
||||||
{
|
{
|
||||||
_color = color;
|
if (_picker is null)
|
||||||
UpdateDecalPlacementInfo();
|
{
|
||||||
RefreshList();
|
_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 =>
|
RotationSpinBox.OnValueChanged += args =>
|
||||||
{
|
{
|
||||||
_rotation = args.Value;
|
_rotation = args.Value;
|
||||||
@@ -77,6 +102,13 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
|
|||||||
Populate();
|
Populate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnColorPicked(Color color)
|
||||||
|
{
|
||||||
|
_color = color;
|
||||||
|
UpdateDecalPlacementInfo();
|
||||||
|
RefreshList();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateDecalPlacementInfo()
|
private void UpdateDecalPlacementInfo()
|
||||||
{
|
{
|
||||||
if (_selected is null)
|
if (_selected is null)
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ decal-placer-window-rotation = Rotation
|
|||||||
decal-placer-window-zindex = Draw Depth
|
decal-placer-window-zindex = Draw Depth
|
||||||
decal-placer-window-enable-snap = Snap To Tile
|
decal-placer-window-enable-snap = Snap To Tile
|
||||||
decal-placer-window-enable-cleanable = Cleanable
|
decal-placer-window-enable-cleanable = Cleanable
|
||||||
|
decal-placer-window-palette = Palette
|
||||||
palette-color-picker-window-title = Palettes
|
palette-color-picker-window-title = Palettes
|
||||||
|
|||||||
Reference in New Issue
Block a user