Files
tbd-station-14/Content.Client/Decals/UI/PaletteColorPicker.xaml.cs
mirrorcult 31769edf5f Decal Placer + add new decals for mapping (#6548)
* abomination

* okay its less unabashedly garbage now

* other UI changes

* its britney bitch

* proper greyscale full/half/quarter tiles

* misc cleanup

* rsi

* Add a palette system. It's Kara's problem now.

* oops

* a

* Departmental palette alpha tweaks

* oopy

* so true

* Update Content.Shared/Decals/ColorPalettePrototype.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* fixes for that

* neutral light color and new warning lines

* dirt

* checkerboards

* oop

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2022-02-08 14:54:41 -06:00

55 lines
1.6 KiB
C#

using Content.Shared.Decals;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
namespace Content.Client.Decals.UI;
[GenerateTypedNameReferences]
public sealed partial class PaletteColorPicker : DefaultWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
private readonly TextureResource _tex;
public PaletteColorPicker()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_tex = _resourceCache.GetResource<TextureResource>("/Textures/Interface/Nano/button.svg.96dpi.png");
var i = 0;
foreach (var palette in _prototypeManager.EnumeratePrototypes<ColorPalettePrototype>())
{
Palettes.AddItem(palette.Name);
Palettes.SetItemMetadata(i, palette); // ew
i += 1;
}
Palettes.OnItemSelected += args =>
{
Palettes.SelectId(args.Id);
SetupList();
};
Palettes.Select(0);
SetupList();
}
private void SetupList()
{
PaletteList.Clear();
foreach (var (color, value) in (Palettes.SelectedMetadata as ColorPalettePrototype)!.Colors)
{
var item = PaletteList.AddItem(color, _tex.Texture);
item.Metadata = value;
item.IconModulate = value;
}
}
}