Beispiel #1
0
    public override void Read(
        TagRecord _Tag
        , BinaryReader _GAFFileReader
        , ref GAFAnimationData _SharedData
        , ref GAFTimelineData _CurrentTimeline)
    {
        uint framesCount = _GAFFileReader.ReadUInt32();

        for (uint i = 0; i < framesCount; ++i)
        {
            uint         frameNumber = _GAFFileReader.ReadUInt32();
            GAFFrameData frame       = new GAFFrameData(frameNumber);

            bool hasChangesInDisplayList = _GAFFileReader.ReadByte() == 1;
            bool hasActions = _GAFFileReader.ReadByte() == 1;

            if (hasChangesInDisplayList)
            {
                uint statesCount = _GAFFileReader.ReadUInt32();
                for (uint j = 0; j < statesCount; ++j)
                {
                    frame.addState(ExctractState(_GAFFileReader));
                }
            }

            if (hasActions)
            {
                uint actionsCount = _GAFFileReader.ReadUInt32();
                for (uint j = 0; j < actionsCount; ++j)
                {
                    var type       = _GAFFileReader.ReadUInt32();
                    var actionData = new GAFActionData((GAFActionData.ActionType)type);

                    uint parametersCount = _GAFFileReader.ReadUInt32();
                    for (int k = 0; k < parametersCount; ++k)
                    {
                        actionData.parameters.Add(GAFReader.ReadString(_GAFFileReader));
                    }
                }
            }

            _CurrentTimeline.frames.Add(frame.frameNumber, frame);
        }
    }
Beispiel #2
0
    public override void Read(
        TagRecord _Tag
        , BinaryReader _GAFFileReader
        , ref GAFAnimationData _SharedData
        , ref GAFTimelineData _CurrentTimeline)
    {
        uint framesCount = _GAFFileReader.ReadUInt32();

        for (uint i = 0; i < framesCount; ++i)
        {
            uint         frameNumber = _GAFFileReader.ReadUInt32();
            GAFFrameData frame       = new GAFFrameData(frameNumber);

            uint statesCount = _GAFFileReader.ReadUInt32();
            for (uint j = 0; j < statesCount; ++j)
            {
                frame.addState(ExctractState(_GAFFileReader));
            }

            _SharedData.rootTimeline.frames.Add(frame.frameNumber, frame);
        }
    }
Beispiel #3
0
        protected virtual List <GAFObjectStateData> getStates(uint _FrameNumber, bool _RefreshStates)
        {
            if (!_RefreshStates)
            {
                _RefreshStates = _FrameNumber < getCurrentFrameNumber();
            }

            if (_RefreshStates)
            {
                var frame   = new GAFFrameData(_FrameNumber);
                var objects = asset.getObjects(timelineID);
                var frames  = asset.getFrames(timelineID);

                foreach (var _obj in objects)
                {
                    frame.addState(new GAFObjectStateData(_obj.id));
                }

                foreach (var _frame in frames)
                {
                    if (_frame.Key > _FrameNumber)
                    {
                        break;
                    }

                    foreach (var _state in _frame.Value.states)
                    {
                        frame.states[_state.Key] = _state.Value;
                    }
                }

                return(frame.states.Values.ToList());
            }
            else
            {
                var frames = asset.getFrames(timelineID);
                if (_FrameNumber - getCurrentFrameNumber() == 1)
                {
                    if (frames.ContainsKey(_FrameNumber))
                    {
                        return(frames[_FrameNumber].states.Values.ToList());
                    }
                }
                else
                {
                    var frame = new GAFFrameData(_FrameNumber);
                    foreach (var _frame in frames)
                    {
                        if (_frame.Key > _FrameNumber)
                        {
                            break;
                        }

                        if (_frame.Key < getCurrentFrameNumber())
                        {
                            continue;
                        }

                        foreach (var _state in _frame.Value.states)
                        {
                            frame.states[_state.Key] = _state.Value;
                        }
                    }

                    return(frame.states.Values.ToList());
                }

                return(null);
            }
        }
        protected virtual List<GAFObjectStateData> getStates(uint _FrameNumber, bool _RefreshStates)
        {
            if (!_RefreshStates)
            {
                _RefreshStates = _FrameNumber < getCurrentFrameNumber();
            }

            if (_RefreshStates)
            {
                var frame = new GAFFrameData(_FrameNumber);
                var objects = asset.getObjects(timelineID);
                var frames = asset.getFrames(timelineID);

                foreach (var _obj in objects)
                {
                    frame.addState(new GAFObjectStateData(_obj.id));
                }

                foreach (var _frame in frames)
                {
                    if (_frame.Key > _FrameNumber)
                        break;

                    foreach (var _state in _frame.Value.states)
                    {
                        frame.states[_state.Key] = _state.Value;
                    }
                }

                return frame.states.Values.ToList();
            }
            else
            {
                var frames = asset.getFrames(timelineID);
                if (_FrameNumber - getCurrentFrameNumber() == 1)
                {
                    if (frames.ContainsKey(_FrameNumber))
                    {
                        return frames[_FrameNumber].states.Values.ToList();
                    }
                }
                else
                {
                    var frame = new GAFFrameData(_FrameNumber);
                    foreach (var _frame in frames)
                    {
                        if (_frame.Key > _FrameNumber)
                            break;

                        if (_frame.Key < getCurrentFrameNumber())
                            continue;

                        foreach (var _state in _frame.Value.states)
                        {
                            frame.states[_state.Key] = _state.Value;
                        }
                    }

                    return frame.states.Values.ToList();
                }

                return null;
            }
        }