public ColorPaletteDialog(PaletteIndex paletteIndex, int colorPosition)
        {
            InitializeComponent();

            _paletteIndex  = paletteIndex;
            _colorPosition = colorPosition;

            SignalManager.Get <ColorPaletteSelectSignal>().Listener += OnColorPaletteSelect;
            SignalManager.Get <CloseDialogSignal>().Listener        += OnCloseDialog;
        }
Beispiel #2
0
    public void SetPalette(PaletteIndex index)
    {
        Texture2D colorSwapTex;

        colorSwapTex = (Texture2D)_spriteRenderer.material.GetTexture("_SwapTex");
        for (int i = 0; i < colorSwapTex.width; ++i)
        {
            Color c = colorSwapTex.GetPixel(i, (8 * (int)index) + 4);
            colorSwapTex.SetPixel(i, 0, c);
        }
        colorSwapTex.Apply();
    }
Beispiel #3
0
        public override void SerializeImpl(SerializerObject s)
        {
            TileSetIndices = s.SerializeObjectArray <GBAIsometric_Spyro_DataBlockIndex>(TileSetIndices, 4, name: nameof(TileSetIndices));
            MapIndex       = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(MapIndex, name: nameof(MapIndex));
            PaletteIndex   = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(PaletteIndex, name: nameof(PaletteIndex));

            if (TileSets == null)
            {
                TileSets = new byte[TileSetIndices.Length][];
            }

            for (int i = 0; i < TileSets.Length; i++)
            {
                TileSets[i] = TileSetIndices[i].DoAtBlock(size => s.SerializeArray <byte>(TileSets[i], size, name: $"{nameof(TileSets)}[{i}]"));
            }

            Map     = MapIndex.DoAtBlock(size => s.SerializeObject <GBAIsometric_Spyro_SpriteMap>(Map, name: nameof(Map)));
            Palette = PaletteIndex.DoAtBlock(size => s.SerializeObjectArray <RGBA5551Color>(Palette, 256, name: nameof(Palette)));

            s.Log($"Min: {Map.MapData.Where(x => x.TileMapY > 1).Min(x => x.TileMapY)}");
        }
Beispiel #4
0
        public override void Execute(object parameter)
        {
            object[]    values        = (object[])parameter;
            UserControl userControl   = (UserControl)values[0];
            int         colorPosition = (int)values[1];

            PaletteIndex paletteIndex = PaletteIndex.Palette0;

            if (values.Length > 2)
            {
                paletteIndex = (PaletteIndex)values[2];
            }

            Window window = Window.GetWindow(userControl);

            ColorPaletteDialog dialog = new ColorPaletteDialog(paletteIndex, colorPosition)
            {
                Owner = window
            };

            dialog.ShowDialog();
        }
Beispiel #5
0
        private void OnColorPaletteControlSelected(Color color, PaletteIndex paletteIndex, int colorPosition)
        {
            if (DataContext is MapViewModel viewModel)
            {
                if (!viewModel.IsActive)
                {
                    return;
                }
            }

            SolidColorBrush scb = new SolidColorBrush
            {
                Color = color
            };

            PaletteView palette = null;

            switch (paletteIndex)
            {
            case PaletteIndex.Palette0: palette = palette0; break;

            case PaletteIndex.Palette1: palette = palette1; break;

            case PaletteIndex.Palette2: palette = palette2; break;

            case PaletteIndex.Palette3: palette = palette3; break;
            }

            switch (colorPosition)
            {
            case 0: palette.cvsColor0.Background = scb; break;

            case 1: palette.cvsColor1.Background = scb; break;

            case 2: palette.cvsColor2.Background = scb; break;

            case 3: palette.cvsColor3.Background = scb; break;
            }
        }
Beispiel #6
0
        private void OnColorPaletteControlSelected(Color color, PaletteIndex paletteIndex, int colorPosition)
        {
            if (DataContext is PaletteViewModel viewModel)
            {
                if (!viewModel.IsActive)
                {
                    return;
                }
            }

            SolidColorBrush scb = new SolidColorBrush
            {
                Color = color
            };

            switch (colorPosition)
            {
            case 0:
                palette.cvsColor0.Background = scb;
                palette.hexColor0.Text       = Util.ColorToColorHex(color);
                break;

            case 1:
                palette.cvsColor1.Background = scb;
                palette.hexColor1.Text       = Util.ColorToColorHex(color);
                break;

            case 2:
                palette.cvsColor2.Background = scb;
                palette.hexColor2.Text       = Util.ColorToColorHex(color);
                break;

            case 3:
                palette.cvsColor3.Background = scb;
                palette.hexColor3.Text       = Util.ColorToColorHex(color);
                break;
            }
        }
Beispiel #7
0
        private void OnColorPaletteControlSelected(Color color, PaletteIndex paletteIndex, int colorPosition)
        {
            if (!IsActive)
            {
                return;
            }

            if (_doNotSavePalettes)
            {
                return;
            }

            int colorInt = ((color.R & 0xff) << 16) | ((color.G & 0xff) << 8) | (color.B & 0xff);

            int color0 = GetModel().Color0;
            int color1 = GetModel().Color1;
            int color2 = GetModel().Color2;
            int color3 = GetModel().Color3;

            switch (colorPosition)
            {
            case 0: color0 = colorInt; break;

            case 1: color1 = colorInt; break;

            case 2: color2 = colorInt; break;

            case 3: color3 = colorInt; break;
            }

            GetModel().Color0 = color0;
            GetModel().Color1 = color1;
            GetModel().Color2 = color2;
            GetModel().Color3 = color3;

            ProjectItem.FileHandler.Save();
        }
Beispiel #8
0
 public void SetPalette(PaletteIndex index)
 {
     _palSprite.SetPalette(index);
 }
Beispiel #9
0
 public uint this[PaletteIndex selection] => Colors[(int)selection];
Beispiel #10
0
 public Glyph(Char c, PaletteIndex colorIndex = PaletteIndex.Default, bool multiLineComment = false)
 {
     character        = c;
     MultiLinecomment = multiLineComment;
     ColorIndex       = colorIndex;
 }