ReadByte() public static method

public static ReadByte ( byte data, Cursor cursor ) : byte
data byte
cursor Cursor
return byte
コード例 #1
0
        public TagDefineMovie(Flash flash, byte[] data, Cursor cursor) : base(flash, data, cursor)
        {
            int tagsCount = Utils.ReadInt32(data, cursor);

            _tags = new ITag[tagsCount];
            for (int i = 0; i < tagsCount; i++)
            {
                byte type = Utils.ReadByte(data, cursor);
                if (type == TagPlaceObject.TYPE)
                {
                    ITag tag = new TagPlaceObject(this.flash, data, cursor);
                    _tags[i] = tag;
                }
                else if (type == TagRemoveObject.TYPE)
                {
                    ITag tag = new TagRemoveObject(this.flash, data, cursor);
                    _tags[i] = tag;
                }
            }

            _maxDepth = Utils.ReadInt32(data, cursor);

            int framesCount = Utils.ReadInt32(data, cursor);

            _frames = new Frame[framesCount];
            for (int i = 0; i < framesCount; i++)
            {
                Frame frame = new Frame(i, data, cursor);
                _frames[i] = frame;
            }
        }
コード例 #2
0
 public FrameObject(byte[] data, Cursor cursor)
 {
     this.characterId        = Utils.ReadInt32(data, cursor);
     this.placedAtIndex      = Utils.ReadInt32(data, cursor);
     this.lastModfiedAtIndex = Utils.ReadInt32(data, cursor);
     this.isKeyFrame         = Utils.ReadByte(data, cursor) != 0;
 }
コード例 #3
0
        public TagPlaceObject(Flash flash, byte[] data, Cursor cursor)
        {
            this.flash = flash;
            int dataLength = Utils.ReadInt32(data, cursor);
            int nextIndex  = cursor.index + dataLength;

            //parse
            hasMatrix         = Utils.ReadByte(data, cursor) != 0;
            hasMove           = Utils.ReadByte(data, cursor) != 0;
            hasCharacter      = Utils.ReadByte(data, cursor) != 0;
            hasColorTransform = Utils.ReadByte(data, cursor) != 0;
            bool hasName = Utils.ReadByte(data, cursor) != 0;

            hasVisible = Utils.ReadByte(data, cursor) != 0;
            depth      = Utils.ReadInt32(data, cursor);

            if (hasCharacter)
            {
                characterId = Utils.ReadInt32(data, cursor);
            }

            if (hasMatrix)
            {
                position = Utils.ReadVector2(data, cursor);
                rotation = Utils.ReadFloat(data, cursor);
                scaleX   = Utils.ReadFloat(data, cursor);
                scaleY   = Utils.ReadFloat(data, cursor);
            }
            else
            {
                position = Vector2.zero;
                rotation = 0;
                scaleX   = 1;
                scaleY   = 1;
            }
            if (hasVisible)
            {
                visible = Utils.ReadByte(data, cursor) != 0;
            }

            if (hasColorTransform)
            {
                colorTransform = Utils.ReadColorTransform(data, cursor);
            }
            else
            {
                colorTransform = ColorTransform.Default;
            }

            if (hasName)
            {
                instanceName = Utils.ReadString(data, cursor);
            }

            cursor.index = nextIndex;
        }
コード例 #4
0
        public static Color32 ReadColor4B(byte[] data, Cursor cursor)
        {
            Color32 color = new Color32();

            color.r = Utils.ReadByte(data, cursor);
            color.g = Utils.ReadByte(data, cursor);
            color.b = Utils.ReadByte(data, cursor);
            color.a = Utils.ReadByte(data, cursor);
            return(color);
        }
コード例 #5
0
        public static ColorTransform ReadColorTransform(byte[] data, Cursor cursor)
        {
            ColorTransform ctr   = new ColorTransform();
            int            mtype = Utils.ReadInt32(data, cursor);

            if (mtype == 1)
            {
                ctr.tint = new Color(1, 1, 1, 1);
            }
            else if (mtype == 2)
            {
                Color color = new Color();
                color.r  = Utils.ReadFloat(data, cursor);
                color.g  = Utils.ReadFloat(data, cursor);
                color.b  = Utils.ReadFloat(data, cursor);
                color.a  = Utils.ReadFloat(data, cursor);
                ctr.tint = color;
            }
            else
            {
                ctr.tint = new Color(0, 0, 0, 0);
            }
            int atype = Utils.ReadInt32(data, cursor);

            if (atype == 1)
            {
                ctr.add = new Color(255, 255, 255, 255);
            }
            else if (atype == 2)
            {
                Color32 color = new Color();
                color.r = Utils.ReadByte(data, cursor);
                color.g = Utils.ReadByte(data, cursor);
                color.b = Utils.ReadByte(data, cursor);
                color.a = Utils.ReadByte(data, cursor);
                ctr.add = color;
            }
            else
            {
                ctr.add = new Color(0, 0, 0, 0);
            }
            return(ctr);
        }
コード例 #6
0
        void readHeader(byte[] data, Cursor cursor)
        {
            int len      = Utils.ReadLength(data, cursor);
            int newIndex = cursor.index + len;

            version = Utils.ReadInt32(data, cursor);

            int supportedVersion = Utils.ReadInt32(data, cursor);

            NSUtils.Assert(LIB_VERSION >= supportedVersion, "BBGamelib:flash: library {0} is not supported by swf parser {1} ",
                           versionToString(LIB_VERSION), versionToString(supportedVersion));

            flashVersion = Utils.ReadByte(data, cursor);
            frameRate    = Utils.ReadByte(data, cursor);
            frameSize    = Utils.ReadVector2(data, cursor);
            prefix       = Utils.ReadString(data, cursor);

            cursor.index = newIndex;
        }
コード例 #7
0
        public TagDefine parseDefine(Flash flash, byte[] data, Cursor cursor)
        {
            //find nextIndex
            int dataLength = Utils.ReadInt32(data, cursor);
            int nextIndex  = cursor.index + dataLength;

            //parse
            byte      type = Utils.ReadByte(data, cursor);
            TagDefine def  = null;

            if (type == TagDefine.DEF_TYPE_GRAPHIC)
            {
                def = new TagDefineGraphic(flash, data, cursor);
            }
            else if (type == TagDefine.DEF_TYPE_SPRITE)
            {
                def = new TagDefineMovie(flash, data, cursor);
            }

            //nextIndex
            cursor.index = nextIndex;

            return(def);
        }