清理调试日志
This commit is contained in:
@@ -36,7 +36,6 @@ export function EntityInspector({ entityStore: _entityStore, messageHub }: Entit
|
||||
const handleEntityDetails = (event: Event) => {
|
||||
const customEvent = event as CustomEvent;
|
||||
const details = customEvent.detail;
|
||||
console.log('[EntityInspector] Received entity details:', details);
|
||||
setRemoteEntityDetails(details);
|
||||
};
|
||||
|
||||
@@ -61,9 +60,7 @@ export function EntityInspector({ entityStore: _entityStore, messageHub }: Entit
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Attempting to create component:', componentName);
|
||||
const component = componentRegistry.createInstance(componentName);
|
||||
console.log('Created component:', component);
|
||||
|
||||
if (component) {
|
||||
selectedEntity.addComponent(component);
|
||||
|
||||
@@ -48,19 +48,14 @@ export function SceneHierarchy({ entityStore, messageHub }: SceneHierarchyProps)
|
||||
const profilerService = (window as any).__PROFILER_SERVICE__ as ProfilerService | undefined;
|
||||
|
||||
if (!profilerService) {
|
||||
console.warn('[SceneHierarchy] ProfilerService not available');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[SceneHierarchy] Subscribing to ProfilerService');
|
||||
|
||||
const unsubscribe = profilerService.subscribe((data) => {
|
||||
const connected = profilerService.isConnected();
|
||||
console.log('[SceneHierarchy] Received data, connected:', connected, 'entities:', data.entities?.length || 0);
|
||||
setIsRemoteConnected(connected);
|
||||
|
||||
if (connected && data.entities && data.entities.length > 0) {
|
||||
console.log('[SceneHierarchy] Setting remote entities:', data.entities);
|
||||
setRemoteEntities(data.entities);
|
||||
} else {
|
||||
setRemoteEntities([]);
|
||||
|
||||
@@ -125,8 +125,7 @@ export class ProfilerService {
|
||||
private async startServer(): Promise<void> {
|
||||
try {
|
||||
const port = parseInt(this.wsPort);
|
||||
const result = await invoke<string>('start_profiler_server', { port });
|
||||
console.log('[ProfilerService]', result);
|
||||
await invoke<string>('start_profiler_server', { port });
|
||||
this.isServerRunning = true;
|
||||
} catch (error) {
|
||||
console.error('[ProfilerService] Failed to start server:', error);
|
||||
@@ -137,16 +136,13 @@ export class ProfilerService {
|
||||
if (this.ws) return;
|
||||
|
||||
try {
|
||||
console.log(`[ProfilerService] Connecting to ws://localhost:${this.wsPort}`);
|
||||
const ws = new WebSocket(`ws://localhost:${this.wsPort}`);
|
||||
|
||||
ws.onopen = () => {
|
||||
console.log('[ProfilerService] Connected to profiler server');
|
||||
this.notifyListeners(this.createEmptyData());
|
||||
};
|
||||
|
||||
ws.onclose = () => {
|
||||
console.log('[ProfilerService] Disconnected from profiler server');
|
||||
this.ws = null;
|
||||
|
||||
// 如果服务器还在运行,尝试重连
|
||||
@@ -186,7 +182,6 @@ export class ProfilerService {
|
||||
|
||||
public requestEntityDetails(entityId: number): void {
|
||||
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
||||
console.warn('[ProfilerService] Cannot request entity details: WebSocket not connected');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -196,7 +191,6 @@ export class ProfilerService {
|
||||
requestId: `entity_details_${entityId}_${Date.now()}`,
|
||||
entityId
|
||||
};
|
||||
console.log('[ProfilerService] Requesting entity details:', request);
|
||||
this.ws.send(JSON.stringify(request));
|
||||
} catch (error) {
|
||||
console.error('[ProfilerService] Failed to request entity details:', error);
|
||||
@@ -251,7 +245,6 @@ export class ProfilerService {
|
||||
|
||||
private requestRawEntityList(): void {
|
||||
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
||||
console.warn('[ProfilerService] Cannot request entity list: WebSocket not connected');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -260,7 +253,6 @@ export class ProfilerService {
|
||||
type: 'get_raw_entity_list',
|
||||
requestId: `entity_list_${Date.now()}`
|
||||
};
|
||||
console.log('[ProfilerService] Requesting entity list:', request);
|
||||
this.ws.send(JSON.stringify(request));
|
||||
} catch (error) {
|
||||
console.error('[ProfilerService] Failed to request entity list:', error);
|
||||
@@ -269,12 +261,9 @@ export class ProfilerService {
|
||||
|
||||
private handleRawEntityListResponse(data: any): void {
|
||||
if (!data || !Array.isArray(data)) {
|
||||
console.warn('[ProfilerService] Invalid raw entity list response:', data);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[ProfilerService] Received raw entity list, count:', data.length);
|
||||
|
||||
const entities: RemoteEntity[] = data.map((e: any) => ({
|
||||
id: e.id,
|
||||
name: e.name || `Entity ${e.id}`,
|
||||
@@ -298,12 +287,9 @@ export class ProfilerService {
|
||||
|
||||
private handleEntityDetailsResponse(data: any): void {
|
||||
if (!data) {
|
||||
console.warn('[ProfilerService] Invalid entity details response:', data);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[ProfilerService] Received entity details:', data);
|
||||
|
||||
const entityDetails: RemoteEntityDetails = {
|
||||
id: data.id,
|
||||
name: data.name || `Entity ${data.id}`,
|
||||
|
||||
Reference in New Issue
Block a user