コード例 #1
0
ファイル: Palettes.cs プロジェクト: AdamRLukaitis/epicedit
 private void Init(byte[] data)
 {
     for (int i = 0; i < this.palettes.Length; i++)
     {
         byte[] paletteData = Palettes.GetPaletteData(data, i);
         this.palettes[i] = new Palette(this, i, paletteData);
         this.palettes[i].ColorChanged  += this.palette_ColorsChanged;
         this.palettes[i].ColorsChanged += this.palette_ColorsChanged;
     }
 }
コード例 #2
0
ファイル: Palettes.cs プロジェクト: AdamRLukaitis/epicedit
        public void SetBytes(byte[] data)
        {
            if (data.Length != Palettes.Size)
            {
                throw new ArgumentException($"Palettes data should have a size of {Palettes.Size} bytes. Actual: {data.Length} bytes.", nameof(data));
            }

            int count = data.Length / Palette.Size;

            for (int i = 0; i < count; i++)
            {
                byte[] paletteData = Palettes.GetPaletteData(data, i);
                this.palettes[i].SetBytes(paletteData);
            }
        }
コード例 #3
0
        public Palette(Palettes collection, int index, byte[] data)
        {
            this.Collection = collection;
            this.index      = index;

            this.colors     = new RomColor[Palette.ColorCount];
            this.backupData = data;

            this.SetBytesInternal(data);

            if (this.Index > 0)
            {
                // Listen to the events of the first palette of the collection,
                // because the first color of the first palette (back color) is shared by all palettes
                // TODO: Consider turning RomColor into a class, make palettes share the same first RomColor,
                // and make colors raise changed events. This way, these hacks will no longer be necessary.
                this.Collection[0].ColorChanged  += this.firstPalette_ColorChanged;
                this.Collection[0].ColorsChanged += this.firstPalette_ColorsChanged;
            }
        }