test pc 3 years ago
parent
commit
a81bd32b2c
2 changed files with 37 additions and 32 deletions
  1. 21 16
      src/move/move.service.ts
  2. 16 16
      src/rotate/rotate.service.ts

+ 21 - 16
src/move/move.service.ts

@@ -213,7 +213,7 @@ export class MoveService implements OnModuleInit {
     end_break_point_id,
     angleIndex,
   ) {
-    console.log('handlejoystick-angle->相机过渡angleIndex-------------------------:'+angleIndex);
+    //console.log('handlejoystick-angle->相机过渡angleIndex-------------------------:'+angleIndex);
     let moveFramesRes, moveFrames;
     let key =
       'moveframe:app_id:' +
@@ -880,13 +880,13 @@ export class MoveService implements OnModuleInit {
       const closestDis = 80; //小于这个距离就跳到邻居呼吸点
       const distance = step * dir_action.speed_level;
       let angle = null;
-      console.log('handlejoystick-angle->:dir_action.move_angle'+dir_action.move_angle)
+      //console.log('handlejoystick-angle->:dir_action.move_angle'+dir_action.move_angle)
       if(user.camera.angle.yaw<0){
         user.camera.angle.yaw = 360 + user.camera.angle.yaw;
       }
       let move_angle = dir_action.move_angle + user.camera.angle.yaw;
       move_angle = move_angle % 360;
-      console.log('handlejoystick-angle->:叠加后move_angle(也是user.angle)'+move_angle)
+      //console.log('handlejoystick-angle->:叠加后move_angle(也是user.angle)'+move_angle)
       //TODO 临时增加断言
       const playerPosition: Point = { x: 0, y: 0, z: 0 };
       playerPosition.x =
@@ -928,7 +928,7 @@ export class MoveService implements OnModuleInit {
       console.log('joystickjoystick:' + this.cameraInfos.length);
 
       if (surroundPointIds.length == 1) {
-        //console.log('handlejoysticktesttest:actionRequest-笔直'+new Date().getTime());
+        console.log('handlejoysticktesttest:actionRequest-笔直'+new Date().getTime());
         return await this.moveDirect(
           playerPosition,
           closestDis,
@@ -1025,7 +1025,7 @@ export class MoveService implements OnModuleInit {
           //   'joystick校验--->' + breakPointId + '-' + singleInfo.breakPointId,
           // );
           //console.log('handlejoysticktesttest校验0角度:'+_angle+','+move_angle)       //这个没办法,得换方案
-          //console.log('handlejoysticktesttest:actionRequest-笔直'+new Date().getTime());
+          console.log('handlejoysticktesttest:actionRequest-笔直'+new Date().getTime());
           return await this.moveDirect(
             playerPosition,
             closestDis,
@@ -1037,7 +1037,7 @@ export class MoveService implements OnModuleInit {
             actionType,
           );
         } else if (count == 1) {
-          //console.log('handlejoysticktesttest:actionRequest-笔直'+new Date().getTime());
+          console.log('handlejoysticktesttest:actionRequest-笔直'+new Date().getTime());
           return await this.moveDirect(
             playerPosition,
             closestDis,
@@ -1053,7 +1053,7 @@ export class MoveService implements OnModuleInit {
             JSON.stringify(user.player.position),
           );
           this.reply.actionResponses[0].actionType = actionType;
-          //console.log('handlejoysticktesttest:actionRequest-停止'+new Date().getTime());
+          console.log('handlejoysticktesttest:actionRequest-停止'+new Date().getTime());
           return this.reply;
         }
       }
@@ -1080,6 +1080,7 @@ export class MoveService implements OnModuleInit {
           debugger;
         }
         chooseBreakPointId = closestNeighorId;
+        closestNeighorId = null;
         return await this.moveCamera(
           breakPointId,
           chooseBreakPointId,
@@ -1105,19 +1106,20 @@ export class MoveService implements OnModuleInit {
           if (cameraInfo.mediaSrc) {
             this.reply.mediaSrc = cameraInfo.mediaSrc;
             this.reply.joystickIDR = cameraInfo.joystickIDR;
+            console.log('handlejoysticktesttest:mediaSrc:'+cameraInfo.mediaSrc);
           }
 
           user.camera.position = JSON.parse(
             JSON.stringify(cameraInfo.camera_position),
           );
-          console.log('handlejoystick-angle->:自由并过渡更新user.angle'+cameraInfo.camera_angle.yaw)
+          //console.log('handlejoystick-angle->:自由并过渡更新user.angle'+cameraInfo.camera_angle.yaw)
           user.camera.angle.yaw = cameraInfo.camera_angle.yaw;
 
           this.sendingFrameForJoystick = true;
         } else {
           console.log('joystick自由--->不合并');
         }
-        //console.log('handlejoysticktesttest:actionRequest-自由'+new Date().getTime());
+        console.log('handlejoysticktesttest:actionRequest-自由'+new Date().getTime());
         return this.reply;
       }
     }
@@ -1180,12 +1182,13 @@ export class MoveService implements OnModuleInit {
         if (cameraInfo.mediaSrc) {
           this.reply.mediaSrc = cameraInfo.mediaSrc;
           this.reply.joystickIDR = cameraInfo.joystickIDR;
+          console.log('handlejoysticktesttest:mediaSrc:'+cameraInfo.mediaSrc);
         }
 
         user.camera.position = JSON.parse(
           JSON.stringify(cameraInfo.camera_position),
         );
-        console.log('handlejoystick-angle->:moveDirect更新user.angle'+cameraInfo.camera_angle.yaw)
+        //console.log('handlejoystick-angle->:moveDirect更新user.angle'+cameraInfo.camera_angle.yaw)
         user.camera.angle.yaw = cameraInfo.camera_angle.yaw;
 
         this.sendingFrameForJoystick = true;
@@ -1278,16 +1281,17 @@ export class MoveService implements OnModuleInit {
         user.camera.position = JSON.parse(
           JSON.stringify(cameraInfo.camera_position),
         );
-        console.log('handlejoystick-angle->:刚刚过渡更新user.angle'+cameraInfo.camera_angle.yaw)
+        //console.log('handlejoystick-angle->:刚刚过渡更新user.angle'+cameraInfo.camera_angle.yaw)
         user.camera.angle.yaw = cameraInfo.camera_angle.yaw;
 
         if (cameraInfo.mediaSrc) {
           this.reply.mediaSrc = cameraInfo.mediaSrc;
           this.reply.joystickIDR = cameraInfo.joystickIDR;
+          console.log('handlejoysticktesttest:mediaSrc:'+cameraInfo.mediaSrc);
         }
         this.sendingFrameForJoystick = true;
       }
-      //console.log('handlejoysticktesttest:actionRequest-镜头过渡'+new Date().getTime());
+      console.log('handlejoysticktesttest:actionRequest-镜头过渡:'+breakPointId+'到'+chooseBreakPointId+'。'+new Date().getTime());
       return this.reply;
     }
   }
@@ -1359,7 +1363,7 @@ export class MoveService implements OnModuleInit {
 
   complementFrame(userId) {
     if (this.cameraInfos.length > 0) {
-      //console.log('handlejoysticktesttest:complementFrame-1 继续'+userId+','+new Date().getTime())
+      console.log('handlejoysticktesttest:complementFrame-1 继续'+userId+','+new Date().getTime())
       const user = this.users[userId];
       const cameraInfo = this.cameraInfos.shift();
       this.reply.traceIds = [];
@@ -1386,6 +1390,7 @@ export class MoveService implements OnModuleInit {
       if (cameraInfo.mediaSrc) {
         this.reply.mediaSrc = cameraInfo.mediaSrc;
         this.reply.joystickIDR = cameraInfo.joystickIDR;
+        console.log('handlejoysticktesttest:mediaSrc:'+cameraInfo.mediaSrc);
       }
 
       user.camera.position = JSON.parse(
@@ -1398,17 +1403,17 @@ export class MoveService implements OnModuleInit {
       return this.reply;
     } else if (this.cameraInfos.length == 0) {
       if (this.reply['newUserStates'][0].renderInfo.isMoving == 1) {
-        //console.log('handlejoysticktesttest:complementFrame-2 停止1'+new Date().getTime())
+        console.log('handlejoysticktesttest:complementFrame-2 停止1'+new Date().getTime())
         return this.stopJoystick(userId);
       } else {
-        //console.log('handlejoysticktesttest:complementFrame-2 停止2'+new Date().getTime())
+        console.log('handlejoysticktesttest:complementFrame-2 停止2'+new Date().getTime())
         return null;
       }
     }
   }
 
   stopJoystick(userId) {
-    //console.log('handlejoysticktesttest:stopJoystick');
+    console.log('handlejoysticktesttest:stopJoystick');
     this.reply.traceIds = [];
     const user = this.users[userId];
     this.reply['newUserStates'][0].userId = userId;

+ 16 - 16
src/rotate/rotate.service.ts

@@ -158,22 +158,22 @@ export class RotateService {
         },
       ],
       actionResponses: [
-        // {
-        //     "actionType": 15,
-        //     "pointType": 100,
-        //     "extra": "",
-        //     "traceId": "d0864cd0-378d-4d49-b7b0-3e8e1b9494c3",
-        //     "packetId": "d44bd2f5-f877-4dd7-868b-803c64f99082",
-        //     "nps": [],
-        //     "peopleNum": 0,
-        //     "zoneId": "",
-        //     "echoMsg": "",
-        //     "reserveDetail": null,
-        //     "userWithAvatarList": [],
-        //     "newUserStates": [],
-        //     "code": 0,
-        //     "msg": ""
-        // }
+        {
+            // "actionType": 15,
+            // "pointType": 100,
+            "extra": "",
+            // "traceId": "d0864cd0-378d-4d49-b7b0-3e8e1b9494c3",
+            // "packetId": "d44bd2f5-f877-4dd7-868b-803c64f99082",
+            "nps": [],
+            "peopleNum": 0,
+            "zoneId": "",
+            "echoMsg": "",
+            "reserveDetail": null,
+            "userWithAvatarList": [],
+            "newUserStates": [],
+            "code": 0,
+            "msg": ""
+        }
       ],
       getStateType: 0,
       code: 0,