forked from sin365/AxibugEmuOnline
Compare commits
No commits in common. "bca708282b2cd7db9dfc645309300516638d4a38" and "0aefa7f8ad60bd8b5654dc08ed06a1c863ab2916" have entirely different histories.
bca708282b
...
0aefa7f8ad
@ -8,10 +8,11 @@ namespace AxiReplay
|
|||||||
/// 客户端当前帧
|
/// 客户端当前帧
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int mCurrClientFrameIdx => mCurrReplay.FrameStartID;
|
public int mCurrClientFrameIdx => mCurrReplay.FrameStartID;
|
||||||
|
//public int mCurrClientFrameIdx
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务器远端当前帧
|
/// 服务器远端当前帧
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int mRemoteFrameIdx { get; private set; } = int.MinValue;
|
public int mRemoteFrameIdx { get; private set; } = -1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 网络数据队列
|
/// 网络数据队列
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,9 +34,9 @@ namespace AxiReplay
|
|||||||
mNetReplayQueue.Clear();
|
mNetReplayQueue.Clear();
|
||||||
mRemoteFrameIdx = 0;
|
mRemoteFrameIdx = 0;
|
||||||
mCurrReplay = default(ReplayStep);
|
mCurrReplay = default(ReplayStep);
|
||||||
mCurrReplay.FrameStartID = int.MinValue;
|
mCurrReplay.FrameStartID = 0;
|
||||||
mNextReplay = default(ReplayStep);
|
mNextReplay = default(ReplayStep);
|
||||||
mNextReplay.FrameStartID = 0;
|
mNextReplay.FrameStartID = -1;
|
||||||
}
|
}
|
||||||
public void InData(ReplayStep inputData, int ServerFrameIdx)
|
public void InData(ReplayStep inputData, int ServerFrameIdx)
|
||||||
{
|
{
|
||||||
@ -51,9 +52,10 @@ namespace AxiReplay
|
|||||||
{
|
{
|
||||||
inputDiff = false;
|
inputDiff = false;
|
||||||
int targetFrame = mCurrClientFrameIdx + addFrame;
|
int targetFrame = mCurrClientFrameIdx + addFrame;
|
||||||
if (targetFrame <= mNextReplay.FrameStartID + 1 && targetFrame <= mRemoteFrameIdx && mNetReplayQueue.Count > 0)
|
if (targetFrame >= mNextReplay.FrameStartID && targetFrame <= mRemoteFrameIdx && mNetReplayQueue.Count > 0)
|
||||||
{
|
{
|
||||||
//当前帧追加
|
//当前帧追加
|
||||||
|
//mCurrClientFrameIdx = targetFrame;
|
||||||
ulong oldInput = mCurrReplay.InPut;
|
ulong oldInput = mCurrReplay.InPut;
|
||||||
mCurrReplay = mNextReplay;
|
mCurrReplay = mNextReplay;
|
||||||
if (oldInput != mCurrReplay.InPut)
|
if (oldInput != mCurrReplay.InPut)
|
||||||
|
|||||||
@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using static AxibugEmuOnline.Client.HttpAPI;
|
using static AxibugEmuOnline.Client.HttpAPI;
|
||||||
using static AxibugEmuOnline.Client.Manager.LogManager;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client.ClientCore
|
namespace AxibugEmuOnline.Client.ClientCore
|
||||||
{
|
{
|
||||||
@ -159,20 +158,7 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
}
|
}
|
||||||
static void OnNoSugarNetLog(int LogLevel, string msg)
|
static void OnNoSugarNetLog(int LogLevel, string msg)
|
||||||
{
|
{
|
||||||
E_LogType logType =(E_LogType)LogLevel;
|
Debug.Log("[AxibugEmuOnline]:" + msg);
|
||||||
switch (logType)
|
|
||||||
{
|
|
||||||
case E_LogType.Debug:
|
|
||||||
case E_LogType.Info:
|
|
||||||
Debug.Log("[AxiEmu]:" + msg);
|
|
||||||
break;
|
|
||||||
case E_LogType.Warning:
|
|
||||||
Debug.LogWarning("[AxiEmu]:" + msg);
|
|
||||||
break;
|
|
||||||
case E_LogType.Error:
|
|
||||||
Debug.LogError("[AxiEmu]:" + msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -407,7 +407,7 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
void RecvHostSyn_RoomFrameAllInputData(byte[] reqData)
|
void RecvHostSyn_RoomFrameAllInputData(byte[] reqData)
|
||||||
{
|
{
|
||||||
Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Syn_RoomFrameAllInputData>(reqData);
|
Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Syn_RoomFrameAllInputData>(reqData);
|
||||||
//App.log.Debug($"ServerFrameID->{msg.ServerFrameID} FrameID->{msg.FrameID} ClientFrame->{netReplay.mCurrClientFrameIdx} InputData->{msg.InputData}");
|
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);
|
netReplay.InData(new ReplayStep() { FrameStartID = (int)msg.FrameID, InPut = msg.InputData }, (int)msg.ServerFrameID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -104,8 +104,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
if (App.roomMgr.netReplay.TryGetNextFrame(out var replayData, out int frameDiff, out bool inputDiff))
|
if (App.roomMgr.netReplay.TryGetNextFrame(out var replayData, out int frameDiff, out bool inputDiff))
|
||||||
{
|
{
|
||||||
App.log.Debug($"TryGetNextFrame remoteFrame->{App.roomMgr.netReplay.mRemoteFrameIdx} diff->{frameDiff} " +
|
|
||||||
$"frame=>{replayData.FrameStartID} InPut=>{replayData.InPut}");
|
|
||||||
m_sampledState = FromNet(replayData);
|
m_sampledState = FromNet(replayData);
|
||||||
var localState = NesControllerMapper.Get().CreateState();
|
var localState = NesControllerMapper.Get().CreateState();
|
||||||
var rawData = ToNet(localState);
|
var rawData = ToNet(localState);
|
||||||
@ -113,8 +111,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
App.log.Error($"Server Lag remoteFrame->{App.roomMgr.netReplay.mRemoteFrameIdx} diff->{frameDiff} " +
|
|
||||||
$"frame=>{replayData.FrameStartID} InPut=>{replayData.InPut}");
|
|
||||||
m_sampledState = default;
|
m_sampledState = default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user