ShouldHaveNext() public method

public ShouldHaveNext ( ) : bool
return bool
示例#1
0
        void LoadPaletteHeaderGroup(PaletteHeaderGroup group)
        {
            PaletteHeaderData header = group.FirstPaletteHeader;
            bool next = true;

            while (next)
            {
                RgbData data = header.Data;
                for (int i = header.FirstPalette; i < header.FirstPalette + header.NumPalettes; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        paletteBuffer[(int)header.PaletteType][i][j] = data.Color;
                        data = data.NextData as RgbData;
                    }
                }

                next = false;

                if (header.ShouldHaveNext())
                {
                    PaletteHeaderData nextHeader = header.NextData as PaletteHeaderData;
                    if (nextHeader != null)
                    {
                        header = nextHeader;
                        next   = true;
                    }
                    // Might wanna print a warning if no next value is found
                }
            }
        }
示例#2
0
        // TODO: error handling
        public Color[][] GetObjPalettes()
        {
            Color[][] ret = new Color[8][];

            PaletteHeaderData palette = firstPaletteHeader;

            while (true)
            {
                Color[][] palettes = palette.GetPalettes();
                if (palette.PaletteType == PaletteType.Sprite)
                {
                    for (int i = 0; i < palette.NumPalettes; i++)
                    {
                        ret[i + palette.FirstPalette] = palettes[i];
                    }
                }
                if (!palette.ShouldHaveNext())
                {
                    break;
                }
                palette = palette.NextData as PaletteHeaderData;
            }
            return(ret);
        }