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); } } }
void onLogicFrameEnd(RAL.LogicFrame frame) { if (_replaying) { return; } //插入队列 playBackQueue.push(frame); }
void onLogicFrameBegin(RAL.LogicFrame frame) { if (_replaying) { return; } //保存状态机 SceneViews.instance.getCurFBScene().createRecord(frame.frameId); }
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); }
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); }
//¼Ç¼²Ã¼ô 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); }
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); } }
public virtual bool canRecordThisFrame(RAL.LogicFrame frame) { return(false); }
public void push(RAL.LogicFrame frame) { replayList.Enqueue(frame); }
private void _doLogicFrameEnd(RAL.LogicFrame frame) { frame.release(_renderActionGenerator); }
private void _doLogicFrameBegin(RAL.LogicFrame frame) { }