Пример #1
0
 public PaletteIndex(PaletteIndex source)
 {
     data = new byte[32];
     for (int i = 0; i < data.Length; i++)
     {
         data[i] = source[i];
     }
 }
Пример #2
0
        public override bool Equals(System.Object obj)
        {
            PaletteIndex pal = obj as PaletteIndex;

            if (pal == null)
            {
                return(false);
            }
            for (int i = 0; i < data.Length; i++)
            {
                if (data[i] != pal[i])
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #3
0
        public static Texture GetTexture(PaletteIndex palIndex)
        {
            Texture2D tex;

            if (!paletteDict.TryGetValue(palIndex, out tex))
            {
                tex            = new Texture2D(4, 8, TextureFormat.RGBA32, false);
                tex.filterMode = FilterMode.Point;
                tex.wrapMode   = TextureWrapMode.Clamp;
                for (int i = 0; i < 32; i++)
                {
                    temp[i] = NES_PALETTE[palIndex[i]];
                }

                tex.SetPixels32(temp);
                tex.Apply();
                paletteDict[new PaletteIndex(palIndex)] = tex;
            }
            return(tex);
        }