void ReceviceCommandMsg(T cmd, params object[] objs) { //Debug.Log("ReceviceCommandMsg frame " + cmd.frame + " frame " + Serializer.Serialize(cmd)); if (SyncDebugSystem.isDebug) { SyncDebugSystem.RecordMsg("cmd_commandComponent", cmd.frame, Serializer.Serialize(cmd)); } //立即返回确认消息 AffirmMsg amsg = new AffirmMsg(); amsg.index = cmd.frame; amsg.time = cmd.time; ProtocolAnalysisService.SendCommand(amsg); if (m_world.IsStart) { EntityBase entity = m_world.GetEntity(cmd.id); AddComp(entity); //自动添加记录组件 PlayerCommandRecordComponent pcrc = entity.GetComp <PlayerCommandRecordComponent>(ComponentType.PlayerCommandRecordComponent); PlayerCommandBase record = pcrc.GetInputCahae(cmd.frame); //判断和本地的预测有没有冲突 if (record == null || !record.EqualsCmd(cmd)) { pcrc.SetConflict(cmd.frame, true); } else { pcrc.SetConflict(cmd.frame, false); } if (pcrc.lastInputFrame < cmd.frame) { pcrc.lastInputFrame = cmd.frame; } pcrc.RecordCommand(cmd); //数据完整校验 if (cmd.frame != 0 && pcrc.GetAllMessage(cmd.frame) && !pcrc.GetAllMessage(cmd.frame - 1)) { ReSendMessage(cmd.frame - 1, cmd.id); } //Recalc(); } else { GameDataCacheComponent gdcc = m_world.GetSingletonComp <GameDataCacheComponent>(); gdcc.m_noExecuteCommandList.Add(cmd); } }