Browse Source

Merge branch 'master' of http://192.168.0.115:3000/zhangyupeng/meta-server

test pc 3 years ago
parent
commit
3b119ffb2e
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/scene/scene.service.ts

+ 7 - 3
src/scene/scene.service.ts

@@ -61,6 +61,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
   private joystickSub: any;
   private clickQueueSub: any;
   private _rotateCurrentFame = -1;
+  private _rotateCount = -1;
 
   private streamServiceSub: any;
   // private roRequestQueue: RxQueue = new DelayQueue(20);
@@ -240,6 +241,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
 
   async rotate(request: RotateRequest) {
     this.handleRotate(request);
+    this._rotateCount += 1;
     //this.logger.log('request', request)
     // this.roRequestQueue.next(request);
     // if (!this.roRequestQueueSub) {
@@ -261,8 +263,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
       let redisMeta: StreamReplyType;
       this.onRotating.next(true);
       const start = performance.now();
-      // 当move时处理
-      if (this.onMoving.value) {
+      // 当move时处理 _rotateCount是移动端同时触发的问题
+      if (this.onMoving.value && this._rotateCount > 5) {
         const lastStreamFrame = this.lastMoveStreamFrame.getValue();
         const metaData: StreamReplyType = JSON.parse(
           lastStreamFrame.metaData,
@@ -413,6 +415,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
     try {
       // if (!this.onMoving.getValue()) {
       const start = performance.now();
+      this._rotateCount = 0;
       const user = this.moveService.users[this.user_id];
       this.logger.log('进入1 - searchRoad');
       this.logger.log('path-start' + user.breakPointId);
@@ -528,10 +531,11 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
   async handlejoystick(request: JoystickRequest) {
     try {
       //const joystickRes = await this.moveService.joystick(request);
+      this._rotateCount = 0;
       const joystickRes = await this.moveService.seqExeJoystick(request);
       this.logger.log(
         'joystick-breakPointId:' +
-        this.moveService.users[this.user_id].breakPointId,
+          this.moveService.users[this.user_id].breakPointId,
       );
       // 有数据 [0]是rotate数据,[1-infinity]是walking数据
       this.logger.log('joystickRes-1', joystickRes);