This commit is contained in:
sin365 2024-11-11 16:12:54 +08:00
parent f40690eee1
commit c6e71ac282
3 changed files with 21 additions and 3 deletions

View File

@ -6,6 +6,7 @@ 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
{ {
@ -158,7 +159,20 @@ namespace AxibugEmuOnline.Client.ClientCore
} }
static void OnNoSugarNetLog(int LogLevel, string msg) static void OnNoSugarNetLog(int LogLevel, string msg)
{ {
Debug.Log("[AxibugEmuOnline]:" + msg); E_LogType logType =(E_LogType)LogLevel;
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;
}
} }
} }

View File

@ -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);
} }

View File

@ -104,6 +104,8 @@ 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);
@ -111,6 +113,8 @@ 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;
} }
} }