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; }
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; }
public Frame(int frameIndex, byte[] data, Cursor cursor) { this.frameIndex = frameIndex; int dataLength = Utils.ReadInt32(data, cursor); int nextIndex = cursor.index + dataLength; //parse label = Utils.ReadString(data, cursor); int objsCount = Utils.ReadInt32(data, cursor); objs = new FrameObject[objsCount]; for (int i = 0; i < objsCount; i++) { FrameObject obj = new FrameObject(data, cursor); objs[i] = obj; } cursor.index = nextIndex; }
public TagDefine(Flash flash, byte[] data, Cursor cursor) { this.flash = flash; this.characterId = Utils.ReadInt32(data, cursor); this.className = Utils.ReadString(data, cursor); }