test pc 3 years ago
parent
commit
a3a9df7294
1 changed files with 17 additions and 12 deletions
  1. 17 12
      src/move/move.service.ts

+ 17 - 12
src/move/move.service.ts

@@ -205,6 +205,11 @@ export class MoveService implements OnModuleInit {
     end_break_point_id,
     end_break_point_id,
     angleIndex,
     angleIndex,
   ) {
   ) {
+
+    if(angleIndex<0){
+      debugger;
+     }
+
     let moveFramesRes, moveFrames;
     let moveFramesRes, moveFrames;
     let key =
     let key =
       'moveframe:app_id:' +
       'moveframe:app_id:' +
@@ -290,9 +295,6 @@ export class MoveService implements OnModuleInit {
         }
         }
         const moveFrames = JSON.parse(moveFramesRes);
         const moveFrames = JSON.parse(moveFramesRes);
         */
         */
-       if(index<0){
-        debugger;
-       }
         const moveFrames = await this.getMoveFrames(
         const moveFrames = await this.getMoveFrames(
           appId,
           appId,
           start_break_point_id,
           start_break_point_id,
@@ -1334,14 +1336,17 @@ export class MoveService implements OnModuleInit {
 
 
   complementFrame(userId) {
   complementFrame(userId) {
     console.log('handlejoysticktesttest:complementFrame:'+this.cameraInfos.length);
     console.log('handlejoysticktesttest:complementFrame:'+this.cameraInfos.length);
-    if (this.cameraInfos.length > 0) {
+    if (this.cameraInfos == null) {
+      this.cameraInfos = [];
+      return null;
+    }
+    else if (this.cameraInfos.length > 0) {
       const user = this.users[userId];
       const user = this.users[userId];
       const cameraInfo = this.cameraInfos.shift();
       const cameraInfo = this.cameraInfos.shift();
       this.reply.traceIds = [];
       this.reply.traceIds = [];
       this.reply['newUserStates'][0].userId = userId;
       this.reply['newUserStates'][0].userId = userId;
       this.reply['actionResponses'][0].traceId = null;
       this.reply['actionResponses'][0].traceId = null;
-      this.reply['newUserStates'][0].playerState.player.angle.yaw =
-        user.player.angle.yaw;
+      this.reply['newUserStates'][0].playerState.player.angle.yaw = user.player.angle.yaw;
       this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
       this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
         JSON.stringify(user.player.position),
         JSON.stringify(user.player.position),
       );
       );
@@ -1362,13 +1367,12 @@ export class MoveService implements OnModuleInit {
         this.reply.mediaSrc = cameraInfo.mediaSrc;
         this.reply.mediaSrc = cameraInfo.mediaSrc;
       }
       }
 
 
-      // if(this.cameraInfos.length == 0){
-      //   this.reply.moveOver = true;
-      // }
       this.sendingFrameForJoystick = true;
       this.sendingFrameForJoystick = true;
       return this.reply;
       return this.reply;
-    } else {
-      return null;
+    } 
+    else if (this.cameraInfos.length == 0){
+      this.cameraInfos = null;
+      return this.stopJoystick(userId)
     }
     }
   }
   }
 
 
@@ -1422,12 +1426,13 @@ export class MoveService implements OnModuleInit {
     this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
     this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
       JSON.stringify(user.player.position),
       JSON.stringify(user.player.position),
     );
     );
+
     this.reply['newUserStates'][0].playerState.camera.angle = JSON.parse(
     this.reply['newUserStates'][0].playerState.camera.angle = JSON.parse(
       JSON.stringify(user.camera.angle),
       JSON.stringify(user.camera.angle),
     );
     );
     this.reply['newUserStates'][0].playerState.camera.position = JSON.parse(
     this.reply['newUserStates'][0].playerState.camera.position = JSON.parse(
       JSON.stringify(user.camera.position),
       JSON.stringify(user.camera.position),
-    );
+    ); 
 
 
     this.reply['newUserStates'][0].playerState.cameraCenter = JSON.parse(
     this.reply['newUserStates'][0].playerState.cameraCenter = JSON.parse(
       JSON.stringify(user.player.position),
       JSON.stringify(user.player.position),