Bläddra i källkod

Merge branch 'master' of http://face3d.4dage.com:7005/zhangyupeng/meta-server

gemercheung 3 år sedan
förälder
incheckning
e5ddb986f2
1 ändrade filer med 44 tillägg och 1 borttagningar
  1. 44 1
      src/move/move.service.ts

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

@@ -290,6 +290,9 @@ export class MoveService implements OnModuleInit {
         }
         const moveFrames = JSON.parse(moveFramesRes);
         */
+       if(index<0){
+        debugger;
+       }
         const moveFrames = await this.getMoveFrames(
           appId,
           start_break_point_id,
@@ -961,7 +964,7 @@ export class MoveService implements OnModuleInit {
         neighPoint.angle = angle;
         neighPoints.push(neighPoint);
         ++count;
-        console.log('handlejoysticktesttest:45°的倍数');
+        //console.log('handlejoysticktesttest:45°的倍数');
         //debugger;
         break;
 
@@ -1330,6 +1333,7 @@ export class MoveService implements OnModuleInit {
   }
 
   complementFrame(userId) {
+    console.log('handlejoysticktesttest:complementFrame:'+this.cameraInfos.length);
     if (this.cameraInfos.length > 0) {
       const user = this.users[userId];
       const cameraInfo = this.cameraInfos.shift();
@@ -1368,7 +1372,46 @@ export class MoveService implements OnModuleInit {
     }
   }
 
+  complementFrames(userId){
+    console.log('handlejoysticktesttest:complementFrames:'+this.cameraInfos.length);
+    const user = this.users[userId];
+    let replys = [];
+    while(this.cameraInfos.length>0){
+      const cameraInfo = this.cameraInfos.shift();
+      this.reply.traceIds = [];
+      this.reply['newUserStates'][0].userId = userId;
+      this.reply['actionResponses'][0].traceId = null;
+      this.reply['newUserStates'][0].playerState.player.angle.yaw =
+        user.player.angle.yaw;
+      this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
+        JSON.stringify(user.player.position),
+      );
+      this.reply['newUserStates'][0].playerState.camera.angle = JSON.parse(
+        JSON.stringify(cameraInfo.camera_angle),
+      );
+      this.reply['newUserStates'][0].playerState.camera.position = JSON.parse(
+        JSON.stringify(cameraInfo.camera_position),
+      );
+
+      this.reply['newUserStates'][0].playerState.cameraCenter = JSON.parse(
+        JSON.stringify(user.player.position),
+      );
+      this.reply['newUserStates'][0].renderInfo.isMoving = 0;
+      this.reply['actionResponses'][0].traceId = null;
+
+      if (cameraInfo.mediaSrc) {
+        this.reply.mediaSrc = cameraInfo.mediaSrc;
+      }
+
+      this.sendingFrameForJoystick = true;
+      replys.push(this.reply);
+    }
+
+    return replys;
+  }
+
   stopJoystick(userId) {
+    console.log('handlejoysticktesttest:stopJoystick');
     this.reply.traceIds = [];
     const user = this.users[userId];
     this.reply['newUserStates'][0].userId = userId;