feat: 移除播放控制器中的调试日志,优化代码整洁性

This commit is contained in:
xudan 2025-10-09 17:07:57 +08:00
parent 3420c7cc9c
commit ab2cd0d346

View File

@ -78,7 +78,6 @@ export function usePlaybackWebSocket(editorService: ShallowRef<EditorService | u
sceneJson.value = msg.data; sceneJson.value = msg.data;
latestRobotData.clear(); latestRobotData.clear();
} else if (msg.type === 'AMR') { } else if (msg.type === 'AMR') {
console.log('[Playback] Received AMR data:', msg.data);
(msg.data as RobotRealtimeInfo[]).forEach(robot => { (msg.data as RobotRealtimeInfo[]).forEach(robot => {
latestRobotData.set(robot.id, robot); latestRobotData.set(robot.id, robot);
}); });
@ -140,12 +139,10 @@ export function usePlaybackWebSocket(editorService: ShallowRef<EditorService | u
const batchUpdateRobots = (updates: Array<{ id: string; data: RobotRealtimeInfo }>) => { const batchUpdateRobots = (updates: Array<{ id: string; data: RobotRealtimeInfo }>) => {
const editor = editorService.value; const editor = editorService.value;
console.log('[Playback] Batch update: Editor service is', editor ? 'available' : 'NOT available', '. Updates to process:', updates);
if (!editor || updates.length === 0) return; if (!editor || updates.length === 0) return;
updates.forEach(({ id, data }) => { updates.forEach(({ id, data }) => {
const robotExists = editor.checkRobotById(id); const robotExists = editor.checkRobotById(id);
console.log(`[Playback] Checking robot ID: ${id}. Exists in editor: ${robotExists}`);
if (robotExists) { if (robotExists) {
const { x, y, angle, ...rest } = data; const { x, y, angle, ...rest } = data;
editor.updateRobot(id, rest); editor.updateRobot(id, rest);
@ -162,7 +159,6 @@ export function usePlaybackWebSocket(editorService: ShallowRef<EditorService | u
const renderLoop = () => { const renderLoop = () => {
try { try {
console.log('[Playback] Render loop executing...');
const updates: Array<{ id: string; data: RobotRealtimeInfo }> = []; const updates: Array<{ id: string; data: RobotRealtimeInfo }> = [];
for (const [id, data] of latestRobotData.entries()) { for (const [id, data] of latestRobotData.entries()) {
updates.push({ id, data }); updates.push({ id, data });
@ -170,7 +166,6 @@ export function usePlaybackWebSocket(editorService: ShallowRef<EditorService | u
latestRobotData.clear(); latestRobotData.clear();
if (updates.length > 0) { if (updates.length > 0) {
console.log(`[Playback] Render loop: Preparing to update ${updates.length} robots.`);
batchUpdateRobots(updates); batchUpdateRobots(updates);
} }