Example #1
0
		public void ReplacePalette(string name, IPalette p)
		{
			if (modifiablePalettes.ContainsKey(name))
				CopyPaletteToBuffer(indices[name], modifiablePalettes[name] = new MutablePalette(p));
			else if (palettes.ContainsKey(name))
				CopyPaletteToBuffer(indices[name], palettes[name] = new ImmutablePalette(p));
			else
				throw new InvalidOperationException("Palette `{0}` does not exist".F(name));
			Texture.SetData(buffer);
		}
		public override void Tick()
		{
			if (cachedColor == Color)
				return;
			cachedColor = Color;

			var newPalette = new MutablePalette(preview);
			newPalette.ApplyRemap(new PlayerColorRemap(RemapIndices, Color, Ramp));
			worldRenderer.ReplacePalette(PaletteName, newPalette);
		}
Example #3
0
 public void ReplacePalette(string name, IPalette p)
 {
     if (mutablePalettes.ContainsKey(name))
     {
         CopyPaletteToBuffer(indices[name], mutablePalettes[name] = new MutablePalette(p));
     }
     else if (palettes.ContainsKey(name))
     {
         CopyPaletteToBuffer(indices[name], palettes[name] = new ImmutablePalette(p));
     }
     else
     {
         throw new InvalidOperationException($"Palette `{name}` does not exist");
     }
     CopyBufferToTexture();
 }
Example #4
0
 public void ReplacePalette(string name, IPalette p)
 {
     if (modifiablePalettes.ContainsKey(name))
     {
         CopyPaletteToBuffer(indices[name], modifiablePalettes[name] = new MutablePalette(p));
     }
     else if (palettes.ContainsKey(name))
     {
         CopyPaletteToBuffer(indices[name], palettes[name] = new ImmutablePalette(p));
     }
     else
     {
         throw new InvalidOperationException("Palette `{0}` does not exist".F(name));
     }
     Texture.SetData(buffer);
 }