|
@@ -59,8 +59,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
private clickQueueSub: any;
|
|
|
|
|
|
private streamServiceSub: any;
|
|
|
- private roRequestQueue: RxQueue = new DelayQueue(20);
|
|
|
- private roQueue: RxQueue = new DelayQueue(10);
|
|
|
+ private roRequestQueue: RxQueue = new DelayQueue(25);
|
|
|
+ private roQueue: RxQueue = new DelayQueue(6);
|
|
|
private clickQueue: RxQueue = new DebounceQueue(500);
|
|
|
private moveQueue: RxQueue = new DelayQueue(20);
|
|
|
private joystickQueue: RxQueue = new DebounceQueue(500);
|
|
@@ -82,43 +82,43 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
});
|
|
|
public users = {};
|
|
|
|
|
|
- initUsers(app_id, userId) {
|
|
|
- const user = {
|
|
|
- appId: null,
|
|
|
- userId: null,
|
|
|
- breakPointId: null,
|
|
|
- roomId: null,
|
|
|
- player: {
|
|
|
- position: { x: -700, y: 0, z: 0 },
|
|
|
- angle: {
|
|
|
- pitch: 0,
|
|
|
- yaw: 0,
|
|
|
- roll: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- camera: {
|
|
|
- position: { x: -1145, y: 0, z: 160 },
|
|
|
- angle: {
|
|
|
- pitch: 0,
|
|
|
- yaw: 0,
|
|
|
- roll: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- rotateInfo: {
|
|
|
- frameIndex: 0,
|
|
|
- horizontal_move: 0,
|
|
|
- mediaSrc: null,
|
|
|
- },
|
|
|
- moveInfo: {},
|
|
|
- // traceIds: [],
|
|
|
- // actionResponses:[]
|
|
|
- };
|
|
|
-
|
|
|
- user.appId = app_id;
|
|
|
- user.userId = userId;
|
|
|
- user.breakPointId = 100;
|
|
|
- this.users[userId] = user;
|
|
|
- }
|
|
|
+ // initUsers(app_id, userId) {
|
|
|
+ // const user = {
|
|
|
+ // appId: null,
|
|
|
+ // userId: null,
|
|
|
+ // breakPointId: null,
|
|
|
+ // roomId: null,
|
|
|
+ // player: {
|
|
|
+ // position: { x: -700, y: 0, z: 0 },
|
|
|
+ // angle: {
|
|
|
+ // pitch: 0,
|
|
|
+ // yaw: 0,
|
|
|
+ // roll: 0,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // camera: {
|
|
|
+ // position: { x: -1145, y: 0, z: 160 },
|
|
|
+ // angle: {
|
|
|
+ // pitch: 0,
|
|
|
+ // yaw: 0,
|
|
|
+ // roll: 0,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // rotateInfo: {
|
|
|
+ // frameIndex: 0,
|
|
|
+ // horizontal_move: 0,
|
|
|
+ // mediaSrc: null,
|
|
|
+ // },
|
|
|
+ // moveInfo: {},
|
|
|
+ // // traceIds: [],
|
|
|
+ // // actionResponses:[]
|
|
|
+ // };
|
|
|
+
|
|
|
+ // user.appId = app_id;
|
|
|
+ // user.userId = userId;
|
|
|
+ // user.breakPointId = 100;
|
|
|
+ // this.users[userId] = user;
|
|
|
+ // }
|
|
|
|
|
|
onModuleInit(): void {
|
|
|
this.sceneGrpcService =
|
|
@@ -156,6 +156,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
public resumeStream(): void {
|
|
|
this.onMoving.next(false);
|
|
|
+ this.onRotating.next(false);
|
|
|
this.isHoldingStream = false;
|
|
|
this.moveframeCnt = -1;
|
|
|
this.rotateframeCnt = -1;
|
|
@@ -328,11 +329,17 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// if (!this.clickQueueSub) {
|
|
|
this.clickQueueSub = this.clickQueue.subscribe(async (request) => {
|
|
|
const user = this.moveService.users[this.user_id];
|
|
|
+ console.log('进入1 - searchRoad');
|
|
|
const path = await this.getRouterService.searchRoad(
|
|
|
user.appId,
|
|
|
user.breakPointId,
|
|
|
req.clicking_action.clicking_point,
|
|
|
);
|
|
|
+ if (!path) {
|
|
|
+ console.log('不存在--path', path);
|
|
|
+ this.resumeStream();
|
|
|
+ return;
|
|
|
+ }
|
|
|
// debugger;
|
|
|
const walkingRes = await this.moveService.move(path, request);
|
|
|
|
|
@@ -453,15 +460,15 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
console.log('type', frame.type);
|
|
|
// delete frame.mediaSrc;
|
|
|
delete frame.type;
|
|
|
- //TODO
|
|
|
- const random_boolean = Math.random() < 0.3;
|
|
|
- // const random_index === 1 ? 3 : random_boolean ? 1 : 3;
|
|
|
+ //TODO IDR
|
|
|
+ const random_index = index === 0 ? 1 : 3;
|
|
|
+ console.log('move frame DIR %s', random_index);
|
|
|
const stream: StreamFrameType = {
|
|
|
frame: -1,
|
|
|
clipPath: clipPath,
|
|
|
metaData: JSON.stringify(frame),
|
|
|
serverTime: this.mockserverTime,
|
|
|
- DIR: 3,
|
|
|
+ DIR: random_index,
|
|
|
type: type,
|
|
|
};
|
|
|
this.moveQueue.next(stream);
|
|
@@ -478,10 +485,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.walkingSub.unsubscribe();
|
|
|
this.walkingSub = null;
|
|
|
}
|
|
|
- if (this.clickQueueSub) {
|
|
|
- this.clickQueueSub.unsubscribe();
|
|
|
- this.clickQueueSub = null;
|
|
|
- }
|
|
|
+ // if (this.clickQueueSub) {
|
|
|
+ // this.clickQueueSub.unsubscribe();
|
|
|
+ // this.clickQueueSub = null;
|
|
|
+ // }
|
|
|
}
|
|
|
handleMoveSteam() {
|
|
|
this.moveQueueSubscription = this.moveQueue.subscribe(
|