gemercheung 3 years ago
parent
commit
bdbbf21ef9
3 changed files with 54 additions and 23 deletions
  1. 15 1
      src/get-router/get-router.service.ts
  2. 15 1
      src/move/move.service.ts
  3. 24 21
      src/scene/scene.service.ts

+ 15 - 1
src/get-router/get-router.service.ts

@@ -10,7 +10,21 @@ export class GetRouterService implements OnModuleInit {
   private logger: Logger = new Logger('GetRouterService');
 
   // eslint-disable-next-line @typescript-eslint/no-empty-function
-  async onModuleInit() {}
+  async onModuleInit() {
+    const app_id = '0000000003';
+    const prefix = '/mnt/metaverse/scene';
+    let path;
+    // let path: string;
+    if (process.env.NODE_ENV === 'development') {
+      path = join(__dirname, `../ws/${app_id}/points-${app_id}.json`);
+      console.log('测试服JSON', path);
+    }
+    if (process.env.NODE_ENV === 'production') {
+      path = join(`${prefix}/${app_id}/points-${app_id}.json`);
+      console.log('正式服JSON', path);
+    }
+    this.loadJSON(path);
+  }
 
   async loadJSON(path) {
     try {

+ 15 - 1
src/move/move.service.ts

@@ -129,7 +129,21 @@ export class MoveService implements OnModuleInit {
   private breakPointInfo: any;
 
   // eslint-disable-next-line @typescript-eslint/no-empty-function
-  async onModuleInit() {}
+  async onModuleInit() {
+    const app_id = '0000000003';
+    const prefix = '/mnt/metaverse/scene';
+    let path;
+    // let path: string;
+    if (process.env.NODE_ENV === 'development') {
+      path = join(__dirname, `../ws/${app_id}/points-${app_id}.json`);
+      console.log('测试服JSON', path);
+    }
+    if (process.env.NODE_ENV === 'production') {
+      path = join(`${prefix}/${app_id}/points-${app_id}.json`);
+      console.log('正式服JSON', path);
+    }
+    this.loadJSON(path);
+  }
 
   async loadJSON(path) {
     try {

+ 24 - 21
src/scene/scene.service.ts

@@ -80,7 +80,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
   private requestIFrameQueueSub: any;
   private roRequestQueueSub: any;
   private rotateTimeStamp: number;
-  private rewalking = false
+  private rewalking = false;
   private firstRender = false;
   private latestBreakPointId: number;
   private isHoldingStream = false;
@@ -226,25 +226,25 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
     try {
       this.rotateService.init(request.app_id, request.user_id);
       // 加载
-      let path: string;
-      if (process.env.NODE_ENV === 'development') {
-        path = join(
-          __dirname,
-          `../ws/${request.app_id}/points-${request.app_id}.json`,
-        );
-        console.log('测试服JSON', path);
-      }
-      if (process.env.NODE_ENV === 'production') {
-        path = join(
-          `${this.configService.get('app.prefix')}/${request.app_id}/points-${
-            request.app_id
-          }.json`,
-        );
-        console.log('正式服JSON', path);
-      }
+      // let path: string;
+      // if (process.env.NODE_ENV === 'development') {
+      //   path = join(
+      //     __dirname,
+      //     `../ws/${request.app_id}/points-${request.app_id}.json`,
+      //   );
+      //   console.log('测试服JSON', path);
+      // }
+      // if (process.env.NODE_ENV === 'production') {
+      //   path = join(
+      //     `${this.configService.get('app.prefix')}/${request.app_id}/points-${
+      //       request.app_id
+      //     }.json`,
+      //   );
+      //   console.log('正式服JSON', path);
+      // }
 
-      this.moveService.loadJSON(path);
-      this.getRouterService.loadJSON(path);
+      // this.moveService.loadJSON(path);
+      // this.getRouterService.loadJSON(path);
       this.startSteaming.next(true);
       this.startStream();
       this.handleStream();
@@ -423,7 +423,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
             );
             this.logger.log('stop-redisMeta', JSON.stringify(redisMeta));
             // 2. 中断重新walking
-            console.log('walking-step-reWalking-1', request.trace_id+','+this.latestWalkingRequest.trace_id);
+            console.log(
+              'walking-step-reWalking-1',
+              request.trace_id + ',' + this.latestWalkingRequest.trace_id,
+            );
             this.handleReWalking(this.latestWalkingRequest);
           }
         },
@@ -539,7 +542,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
    */
   handleReWalking(request: MoveRequest) {
     this.latestWalkingRequest = null;
-    this.rewalking = true
+    this.rewalking = true;
     this.handleWalking(request);
   }