test pc 3 anos atrás
pai
commit
b6c83a6519
2 arquivos alterados com 58 adições e 9 exclusões
  1. 57 9
      src/move/move.service.ts
  2. 1 0
      src/scene/scene.service.ts

+ 57 - 9
src/move/move.service.ts

@@ -828,6 +828,8 @@ export class MoveService implements OnModuleInit {
       this.reply['actionResponses'][0].traceId = traceId;
       this.reply.mediaSrc = null;
 
+      console.log('joystickjoystick:'+this.cameraInfos.length);
+
       if (surroundPointIds.length == 1) {
         console.log(
           'joystick校验--->' + breakPointId + '-' + surroundPointIds[0],
@@ -996,10 +998,31 @@ export class MoveService implements OnModuleInit {
         const cameraInfo = this.getCameraInfo();
         if (cameraInfo != null) {
           console.log('joystick自由--->合并');
-          this.reply['newUserStates'][0].playerState.camera.position =
-            cameraInfo.cameraPosition;
-          this.reply['newUserStates'][0].playerState.camera.angle =
-            cameraInfo.cameraAngle;
+          this.reply['newUserStates'][0].playerState.camera.position = cameraInfo.cameraPosition;
+          this.reply['newUserStates'][0].playerState.camera.angle = cameraInfo.cameraAngle;
+
+          if (cameraInfo.mediaSrc) {
+            this.reply.mediaSrc = cameraInfo.mediaSrc;
+          } 
+          else if (cameraInfo.file_name) {
+            this.reply.mediaSrc =
+              '/' +
+              appId +
+              '/' +
+              breakPointId +
+              '/' +
+              cameraInfo.file_name.substring(
+                0,
+                cameraInfo.file_name.indexOf('.'),
+              ) +
+              '/' +
+              cameraInfo.file_name +
+              '?m=' +
+              new Date().getTime();
+          }
+          if(this.cameraInfos.length == 0){
+            this.reply.moveOver = true;
+          }
         } else {
           console.log('joystick自由--->不合并');
         }
@@ -1053,10 +1076,32 @@ export class MoveService implements OnModuleInit {
       this.reply.actionResponses[0].actionType = actionType;
       const cameraInfo = this.getCameraInfo();
       if (cameraInfo != null) {
-        this.reply['newUserStates'][0].playerState.camera.position =
-          cameraInfo.camera_position;
-        this.reply['newUserStates'][0].playerState.camera.angle =
-          cameraInfo.camera_angle;
+        this.reply['newUserStates'][0].playerState.camera.position = cameraInfo.camera_position;
+        this.reply['newUserStates'][0].playerState.camera.angle = cameraInfo.camera_angle;
+   
+        if (cameraInfo.mediaSrc) {
+          this.reply.mediaSrc = cameraInfo.mediaSrc;
+        } 
+        else if (cameraInfo.file_name) {
+          this.reply.mediaSrc =
+            '/' +
+            appId +
+            '/' +
+            breakPointId +
+            '/' +
+            cameraInfo.file_name.substring(
+              0,
+              cameraInfo.file_name.indexOf('.'),
+            ) +
+            '/' +
+            cameraInfo.file_name +
+            '?m=' +
+            new Date().getTime();
+        }
+
+        if(this.cameraInfos.length == 0){
+          this.reply.moveOver = true;
+        }
       }
       return this.reply;
     }
@@ -1166,6 +1211,7 @@ export class MoveService implements OnModuleInit {
         } else {
           debugger;
         }
+        this.reply.moveStart = true;
       }
       return this.reply;
       // user.camera.position = JSON.parse(
@@ -1177,7 +1223,9 @@ export class MoveService implements OnModuleInit {
   }
 
   setCameraInfo(moveFrames) {
-    this.cameraInfos = moveFrames;
+    for(let i=0;i<moveFrames.length;i += 5){
+      this.cameraInfos.push(moveFrames[i]);
+    }
   }
 
   addCameraInfo(cameraPosition, cameraAngle, mediaSrc) {

+ 1 - 0
src/scene/scene.service.ts

@@ -612,6 +612,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
       // 有数据 [0]是rotate数据,[1-infinity]是walking数据
       this.logger.log('joystickRes-1', joystickRes);
       this.onJoysticking.next(true);
+      console.log('handlejoystick:'+joystickRes.mediaSrc)
       if (Array.isArray(joystickRes)) {
         // 处理第一个镜头数据
         const rotateCamData = joystickRes[0];