diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs index 132f97b..1dee7cf 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace AxiReplay { @@ -104,6 +105,23 @@ namespace AxiReplay data = mCurrReplay; return result; - } + } + + public int GetSkipFrameCount() + { + var frameGap = mDiffFrameCount; + if (frameGap > 10000) return 0; + + int skip = 0; + + if (frameGap <= 2) skip = 0; + if (frameGap > 2 && frameGap < 6) skip = 1 + 1; + else if (frameGap > 7 && frameGap < 12) skip = 2 + 1; + else if (frameGap > 13 && frameGap < 20) skip = 3 + 1; + else skip = frameGap - 2; + + + return skip; + } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs index 1b77ee4..425e9bc 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs @@ -68,15 +68,7 @@ namespace AxibugEmuOnline.Client private void FixEmulatorFrame() { - int skipFrameCount = 0; - var frameGap = App.roomMgr.netReplay.mDiffFrameCount; - if (frameGap > 10000) return; - - if (frameGap <= 2) skipFrameCount = 0; - if (frameGap > 2 && frameGap < 6) skipFrameCount = 1 + 1; - else if (frameGap > 7 && frameGap < 12) skipFrameCount = 2 + 1; - else if (frameGap > 13 && frameGap < 20) skipFrameCount = 3 + 1; - else skipFrameCount = frameGap - 2; + var skipFrameCount = App.roomMgr.netReplay.GetSkipFrameCount(); if (skipFrameCount > 0) App.log.Debug($"SKIP FRAME : {skipFrameCount}"); for (int i = 0; i < skipFrameCount; i++)