Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
        void applyPreKeyTags(int fromFrameIndex, int depth)
        {
            utList <FrameObject> preTags = new utList <FrameObject>();
            bool removed = false, hasCharacter = false;
            int  i = fromFrameIndex;

            for (; i >= 0; i--)
            {
                Frame frame = _define.frames [i];
                for (int k = 0; k < frame.objs.Length; k++)
                {
                    FrameObject frameObj = frame.objs [k];
                    ITag        iTag     = getTag(frameObj);
                    if (iTag is TagRemoveObject)
                    {
                        TagRemoveObject tagRemoveObj = iTag as TagRemoveObject;
                        if (tagRemoveObj.depth == depth)
                        {
                            preTags.DL_APPEND(frameObj);
                            removed = true;
                            break;
                        }
                    }
                    else if (iTag is TagPlaceObject)
                    {
                        TagPlaceObject tagPlaceObj = iTag as TagPlaceObject;
                        if (tagPlaceObj.depth == depth)
                        {
                            preTags.DL_APPEND(frameObj);
                            hasCharacter |= tagPlaceObj.hasCharacter;
                            if (hasCharacter)
                            {
                                break;
                            }
                        }
                    }
                }

                if (removed || (hasCharacter))
                {
                    break;
                }
            }
            if (preTags.head != null)
            {
                for (var ent = preTags.head.prev; ent != preTags.head; ent = ent.prev)
                {
                    FrameObject     frameObj = ent.obj;
                    IDisplayListTag iTag     = getTag(frameObj) as IDisplayListTag;
                    iTag.apply(this, frameObj);
                }
                {
                    FrameObject     frameObj = preTags.head.obj;
                    IDisplayListTag iTag     = getTag(frameObj) as IDisplayListTag;
                    iTag.apply(this, frameObj);
                }
            }
            else
            {
                Display display = _depthDisplays [depth - 1];
                if (display != null)
                {
                    //cache
                    display.removed = true;
                    display.visible = false;
                }
            }
        }