|
@@ -1009,22 +1009,7 @@ export class MoveService implements OnModuleInit {
|
|
|
|
|
|
if (cameraInfo.mediaSrc) {
|
|
if (cameraInfo.mediaSrc) {
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
- } else if (cameraInfo.file_name) {
|
|
|
|
- this.reply.mediaSrc =
|
|
|
|
- '/' +
|
|
|
|
- appId +
|
|
|
|
- '/' +
|
|
|
|
- breakPointId +
|
|
|
|
- '/' +
|
|
|
|
- cameraInfo.file_name.substring(
|
|
|
|
- 0,
|
|
|
|
- cameraInfo.file_name.indexOf('.'),
|
|
|
|
- ) +
|
|
|
|
- '/' +
|
|
|
|
- cameraInfo.file_name +
|
|
|
|
- '?m=' +
|
|
|
|
- new Date().getTime();
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
if (this.cameraInfos.length == 0) {
|
|
if (this.cameraInfos.length == 0) {
|
|
this.reply.moveOver = true;
|
|
this.reply.moveOver = true;
|
|
}
|
|
}
|
|
@@ -1090,23 +1075,7 @@ export class MoveService implements OnModuleInit {
|
|
|
|
|
|
if (cameraInfo.mediaSrc) {
|
|
if (cameraInfo.mediaSrc) {
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
- } else if (cameraInfo.file_name) {
|
|
|
|
- this.reply.mediaSrc =
|
|
|
|
- '/' +
|
|
|
|
- appId +
|
|
|
|
- '/' +
|
|
|
|
- breakPointId +
|
|
|
|
- '/' +
|
|
|
|
- cameraInfo.file_name.substring(
|
|
|
|
- 0,
|
|
|
|
- cameraInfo.file_name.indexOf('.'),
|
|
|
|
- ) +
|
|
|
|
- '/' +
|
|
|
|
- cameraInfo.file_name +
|
|
|
|
- '?m=' +
|
|
|
|
- new Date().getTime();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
if (this.cameraInfos.length == 0) {
|
|
if (this.cameraInfos.length == 0) {
|
|
this.reply.moveOver = true;
|
|
this.reply.moveOver = true;
|
|
}
|
|
}
|
|
@@ -1173,7 +1142,7 @@ export class MoveService implements OnModuleInit {
|
|
Math.floor(user.camera.angle.yaw / 45);
|
|
Math.floor(user.camera.angle.yaw / 45);
|
|
const moveFramesRes = await this.cacheService.get(key);
|
|
const moveFramesRes = await this.cacheService.get(key);
|
|
const moveFrames = JSON.parse(moveFramesRes);
|
|
const moveFrames = JSON.parse(moveFramesRes);
|
|
- this.setCameraInfo(moveFrames,chooseBreakPointId);
|
|
|
|
|
|
+ this.setCameraInfo(appId,moveFrames,breakPointId,chooseBreakPointId);
|
|
//user.breakPointId = chooseBreakPointId;
|
|
//user.breakPointId = chooseBreakPointId;
|
|
const cameraInfo = this.getCameraInfo();
|
|
const cameraInfo = this.getCameraInfo();
|
|
if (cameraInfo != null) {
|
|
if (cameraInfo != null) {
|
|
@@ -1189,24 +1158,7 @@ export class MoveService implements OnModuleInit {
|
|
|
|
|
|
if (cameraInfo.mediaSrc) {
|
|
if (cameraInfo.mediaSrc) {
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
- } else if (cameraInfo.file_name) {
|
|
|
|
- this.reply.mediaSrc =
|
|
|
|
- '/' +
|
|
|
|
- appId +
|
|
|
|
- '/' +
|
|
|
|
- breakPointId +
|
|
|
|
- '/' +
|
|
|
|
- cameraInfo.file_name.substring(
|
|
|
|
- 0,
|
|
|
|
- cameraInfo.file_name.indexOf('.'),
|
|
|
|
- ) +
|
|
|
|
- '/' +
|
|
|
|
- cameraInfo.file_name +
|
|
|
|
- '?m=' +
|
|
|
|
- new Date().getTime();
|
|
|
|
- } else {
|
|
|
|
- debugger;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
this.reply.moveStart = true;
|
|
this.reply.moveStart = true;
|
|
this.sendingFrameForJoystick = true;
|
|
this.sendingFrameForJoystick = true;
|
|
}
|
|
}
|
|
@@ -1214,9 +1166,10 @@ export class MoveService implements OnModuleInit {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- setCameraInfo(moveFrames,endBreakPointId) {
|
|
|
|
|
|
+ setCameraInfo(appId,moveFrames,startBreakPointId,endBreakPointId) {
|
|
for (let i = 0; i < moveFrames.length; i += 5) {
|
|
for (let i = 0; i < moveFrames.length; i += 5) {
|
|
moveFrames[i].endBreakPointId = endBreakPointId;
|
|
moveFrames[i].endBreakPointId = endBreakPointId;
|
|
|
|
+ moveFrames[i].mediaSrc = '/' + appId +'/' + startBreakPointId +'/' + moveFrames[i].file_name.substring( 0, moveFrames[i].file_name.indexOf('.'), ) + '/' +moveFrames[i].file_name + '?m=' +new Date().getTime();
|
|
this.cameraInfos.push(moveFrames[i]);
|
|
this.cameraInfos.push(moveFrames[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1238,6 +1191,39 @@ export class MoveService implements OnModuleInit {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ complementFrame(userId){
|
|
|
|
+ if (this.cameraInfos.length > 0) {
|
|
|
|
+ const user = this.users[userId];
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
async modeifyCameraAngle(angle, userId, traceId, actionType) {
|
|
async modeifyCameraAngle(angle, userId, traceId, actionType) {
|
|
const checkReplys = [];
|
|
const checkReplys = [];
|
|
if (angle > 22) {
|
|
if (angle > 22) {
|