Ejemplo n.º 1
0
    private void _process(ref RAL.LogicFrame frame, ref int physicsIndex, float cursor)
    {
        int nowIndex = (int)(cursor * FrameSync.LOGIC_PHYSICS_FPS);

        if (nowIndex >= frame.physicsFrames.Length)
        {
            for (int i = physicsIndex; i < m_currentFrame.physicsFrames.Length; ++i)
            {
                for (int j = 0; j < frame.physicsFrames[i].actions.Length; ++j)
                {
                    _doRenderActionDone(frame.physicsFrames[i].actions[j]);
                }
            }
            physicsIndex = -1;
            _doLogicFrameEnd(frame);
            frame = null;
        }
        else
        {
            for (int i = physicsIndex; i < nowIndex; ++i)
            {
                for (int j = 0; j < frame.physicsFrames[i].actions.Length; ++j)
                {
                    _doRenderActionDone(frame.physicsFrames[i].actions[j]);
                }
            }
            physicsIndex = nowIndex;
            var progress = cursor * FrameSync.LOGIC_PHYSICS_FPS - nowIndex;
            for (int i = 0; i < frame.physicsFrames[nowIndex].actions.Length; ++i)
            {
                _doRenderActionProgress(frame.physicsFrames[nowIndex].actions[i], progress);
            }
        }
    }
Ejemplo n.º 2
0
    void onLogicFrameEnd(RAL.LogicFrame frame)
    {
        if (_replaying)
        {
            return;
        }

        //插入队列
        playBackQueue.push(frame);
    }
Ejemplo n.º 3
0
    void onLogicFrameBegin(RAL.LogicFrame frame)
    {
        if (_replaying)
        {
            return;
        }

        //保存状态机
        SceneViews.instance.getCurFBScene().createRecord(frame.frameId);
    }
Ejemplo n.º 4
0
 public override bool canRecordThisFrame(RAL.LogicFrame frame)
 {
     for (int j = 0; j < frame.physicsFrames.Length; ++j)
     {
         for (int i = 0; i < frame.physicsFrames[j].actions.Length; ++i)
         {
             if (frame.physicsFrames[j].actions[i].typeID == RenderableActionID.UpdateMatchTimeAction)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        public bool pop(int maxFrameId, out LogicFrame msg)
        {
            msg = null;
            if (m_queue.Count == 0)
            {
                return(false);
            }
            var _msg = m_queue.Peek();

            if (_msg.frameId <= maxFrameId)
            {
                msg = m_queue.Dequeue();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
    //¼Ç¼²Ã¼ô
    public int cast(uint logicFrameID)
    {
        RAL.LogicFrame current = replayList.Peek();
        while (current != null && current.frameId < logicFrameID)
        {
            LogicFrame removedFrame = replayList.Dequeue();
            removedFrame.release(_renderActionGenerator);

            current = replayList.Peek();
        }
        if (current != null)
        {
            return(current.frameId);
        }

        return(-1);
    }
Ejemplo n.º 7
0
 private void _processNewFrame(RAL.LogicFrame frame, float cursor)
 {
     if (m_currentFrame != null)
     {
         for (int i = m_currentPhysicsIndex; i < m_currentFrame.physicsFrames.Length; ++i)
         {
             for (int j = 0; j < m_currentFrame.physicsFrames[i].actions.Length; ++j)
             {
                 _doRenderActionDone(m_currentFrame.physicsFrames[i].actions[j]);
             }
         }
         _doLogicFrameEnd(m_currentFrame);
         m_currentFrame        = null;
         m_currentPhysicsIndex = -1;
     }
     if (frame != null)
     {
         m_currentFrame        = frame;
         m_currentPhysicsIndex = 0;
         _doLogicFrameBegin(frame);
         _process(ref m_currentFrame, ref m_currentPhysicsIndex, cursor);
     }
 }
Ejemplo n.º 8
0
 public virtual bool canRecordThisFrame(RAL.LogicFrame frame)
 {
     return(false);
 }
Ejemplo n.º 9
0
 public void push(RAL.LogicFrame frame)
 {
     replayList.Enqueue(frame);
 }
Ejemplo n.º 10
0
 private void _doLogicFrameEnd(RAL.LogicFrame frame)
 {
     frame.release(_renderActionGenerator);
 }
Ejemplo n.º 11
0
 private void _doLogicFrameBegin(RAL.LogicFrame frame)
 {
 }