diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs
index a94ea03..fba2489 100644
--- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs
+++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs
@@ -7,7 +7,8 @@ namespace AxiReplay
///
/// 客户端当前帧
///
- public int mCurrClientFrameIdx { get; private set; } = -1;
+ public int mCurrClientFrameIdx => mCurrReplay.FrameStartID;
+ //public int mCurrClientFrameIdx
///
/// 服务器远端当前帧
///
@@ -20,6 +21,10 @@ namespace AxiReplay
/// 当前数据
///
ReplayStep mCurrReplay;
+ ///
+ /// 下一个数据数据
+ ///
+ ReplayStep mNextReplay;
public NetReplay()
{
ResetData();
@@ -29,6 +34,9 @@ namespace AxiReplay
mNetReplayQueue.Clear();
mRemoteFrameIdx = 0;
mCurrReplay = default(ReplayStep);
+ mCurrReplay.FrameStartID = 0;
+ mNextReplay = default(ReplayStep);
+ mNextReplay.FrameStartID = -1;
}
public void InData(ReplayStep inputData, int ServerFrameIdx)
{
@@ -43,15 +51,16 @@ namespace AxiReplay
void TakeFrame(int addFrame, out ReplayStep data, out int bFrameDiff, out bool inputDiff)
{
inputDiff = false;
- int targetFrame = mCurrClientFrameIdx += addFrame;
- if (targetFrame <= mRemoteFrameIdx && mNetReplayQueue.Count > 0)
+ int targetFrame = mCurrClientFrameIdx + addFrame;
+ if (targetFrame >= mNextReplay.FrameStartID && targetFrame <= mRemoteFrameIdx && mNetReplayQueue.Count > 0)
{
//当前帧追加
- mCurrClientFrameIdx = targetFrame;
+ //mCurrClientFrameIdx = targetFrame;
ulong oldInput = mCurrReplay.InPut;
- mCurrReplay = mNetReplayQueue.Dequeue();
+ mCurrReplay = mNextReplay;
if (oldInput != mCurrReplay.InPut)
inputDiff = true;
+ mNextReplay = mNetReplayQueue.Dequeue();
}
bFrameDiff = mRemoteFrameIdx - mCurrClientFrameIdx;
data = mCurrReplay;
diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs
index 2166f64..5be4626 100644
--- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs
+++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs
@@ -407,6 +407,7 @@ namespace AxibugEmuOnline.Client.Manager
void RecvHostSyn_RoomFrameAllInputData(byte[] reqData)
{
Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize(reqData);
+ App.log.Debug($"ServerFrameID->{msg.ServerFrameID} FrameID->{msg.FrameID} ClientFrame->{netReplay.mCurrClientFrameIdx} InputData->{msg.InputData}");
netReplay.InData(new ReplayStep() { FrameStartID = (int)msg.FrameID, InPut = msg.InputData }, (int)msg.ServerFrameID);
}