From 36787e10189fece8fa009a2c5a4c45f363adb02f Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Tue, 12 Nov 2024 09:56:07 +0800 Subject: [PATCH 1/2] NetReplay --- .../Assets/Plugins/AxiReplay/NetReplay.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs index 086e06a..9ed0edf 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs @@ -51,10 +51,22 @@ namespace AxiReplay TakeFrame(1, out data, out frameDiff, out inputDiff); return frameDiff > 0; } + + public bool TryGetNextFrame(int targetFrame, out ReplayStep data, out int frameDiff, out bool inputDiff) + { + TakeFrameToTargetFrame(targetFrame, out data, out frameDiff, out inputDiff); + return frameDiff > 0; + } + void TakeFrame(int addFrame, out ReplayStep data, out int bFrameDiff, out bool inputDiff) { - inputDiff = false; int targetFrame = mCurrClientFrameIdx + addFrame; + TakeFrameToTargetFrame(targetFrame, out data, out bFrameDiff, out inputDiff); + } + + void TakeFrameToTargetFrame(int targetFrame, out ReplayStep data, out int bFrameDiff, out bool inputDiff) + { + inputDiff = false; if (targetFrame <= mNextReplay.FrameStartID + 1 && targetFrame <= mRemoteFrameIdx && mNetReplayQueue.Count > 0) { //当前帧追加 From 0e96b4619aa69fa6b318030e256a7dbe37683fd8 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Tue, 12 Nov 2024 09:59:09 +0800 Subject: [PATCH 2/2] NetReplay --- AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs index 9ed0edf..162d5b9 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs @@ -11,7 +11,7 @@ namespace AxiReplay /// /// 服务器远端当前帧 /// - public int mRemoteFrameIdx { get; private set; } = int.MinValue; + public int mRemoteFrameIdx { get; private set; } /// /// Remote 2 Client Frame Gap /// @@ -40,6 +40,7 @@ namespace AxiReplay mCurrReplay.FrameStartID = int.MinValue; mNextReplay = default(ReplayStep); mNextReplay.FrameStartID = 0; + mRemoteFrameIdx = 0; } public void InData(ReplayStep inputData, int ServerFrameIdx) {