Exemplo n.º 1
0
    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();
    }