|
@@ -436,9 +436,9 @@ export class MoveService implements OnModuleInit {
|
|
|
const user = this.users[userId];
|
|
|
user.breakPointId = breakPointId;
|
|
|
|
|
|
- if(lastReply.actionResponses[0].actionType != 15)
|
|
|
- {
|
|
|
- user.player.position = lastReply['newUserStates'][0].playerState.player.position;
|
|
|
+ if (lastReply.actionResponses[0].actionType != 15) {
|
|
|
+ user.player.position =
|
|
|
+ lastReply['newUserStates'][0].playerState.player.position;
|
|
|
}
|
|
|
user.player.angle = lastReply['newUserStates'][0].playerState.player.angle;
|
|
|
user.camera.position =
|
|
@@ -683,7 +683,6 @@ export class MoveService implements OnModuleInit {
|
|
|
// neighPoints.push(neighPoint);
|
|
|
// ++count;
|
|
|
// }
|
|
|
-
|
|
|
|
|
|
// if(Math.abs(angle - move_angle)<45||Math.abs(angle+360 - move_angle)<45){
|
|
|
// if(singleInfo == null){
|
|
@@ -701,7 +700,7 @@ export class MoveService implements OnModuleInit {
|
|
|
// this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
|
|
|
// JSON.stringify(playerPosition),
|
|
|
// );
|
|
|
- // }
|
|
|
+ // }
|
|
|
// else{
|
|
|
// if(singleInfo != null){
|
|
|
// return await this.moveDirect(
|
|
@@ -780,72 +779,119 @@ export class MoveService implements OnModuleInit {
|
|
|
async joystick(actionRequest) {
|
|
|
//try {
|
|
|
|
|
|
+ if (this.sendingFrameForJoystick) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
- if(this.sendingFrameForJoystick){
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- const userId = actionRequest['user_id'];
|
|
|
- const traceId = actionRequest['trace_id'];
|
|
|
- const dir_action = actionRequest['dir_action'];
|
|
|
- const actionType = actionRequest['action_type'];
|
|
|
- const user = this.users[userId];
|
|
|
- const breakPointId = user.breakPointId;
|
|
|
- const appId = user.appId;
|
|
|
+ const userId = actionRequest['user_id'];
|
|
|
+ const traceId = actionRequest['trace_id'];
|
|
|
+ const dir_action = actionRequest['dir_action'];
|
|
|
+ const actionType = actionRequest['action_type'];
|
|
|
+ const user = this.users[userId];
|
|
|
+ const breakPointId = user.breakPointId;
|
|
|
+ const appId = user.appId;
|
|
|
|
|
|
- const step = 0.3;
|
|
|
- const closestDis = 85; //小于这个距离就跳到邻居呼吸点
|
|
|
- const distance = step * dir_action.speed_level;
|
|
|
- let angle = null;
|
|
|
- let move_angle = dir_action.move_angle + user.camera.angle.yaw;
|
|
|
- move_angle = move_angle % 360;
|
|
|
-
|
|
|
- //TODO 临时增加断言
|
|
|
- const playerPosition: Point = { x: 0, y: 0, z: 0 };
|
|
|
- playerPosition.x =
|
|
|
- user.player.position.x +
|
|
|
- distance * Math.cos((move_angle / 360) * 2 * Math.PI);
|
|
|
- playerPosition.y =
|
|
|
- user.player.position.y +
|
|
|
- distance * Math.sin((move_angle / 360) * 2 * Math.PI);
|
|
|
-
|
|
|
- //找到邻居点,判断user.player.position与邻居点的距离,如果距离小于closestDis,就要更新camera的position
|
|
|
- let chooseBreakPointId = null;
|
|
|
- const breakPoint = this.breakPointInfo[breakPointId];
|
|
|
- const surroundPointIds = breakPoint.contact;
|
|
|
- const traceIds = [];
|
|
|
+ const step = 0.3;
|
|
|
+ const closestDis = 85; //小于这个距离就跳到邻居呼吸点
|
|
|
+ const distance = step * dir_action.speed_level;
|
|
|
+ let angle = null;
|
|
|
+ let move_angle = dir_action.move_angle + user.camera.angle.yaw;
|
|
|
+ move_angle = move_angle % 360;
|
|
|
+
|
|
|
+ //TODO 临时增加断言
|
|
|
+ const playerPosition: Point = { x: 0, y: 0, z: 0 };
|
|
|
+ playerPosition.x =
|
|
|
+ user.player.position.x +
|
|
|
+ distance * Math.cos((move_angle / 360) * 2 * Math.PI);
|
|
|
+ playerPosition.y =
|
|
|
+ user.player.position.y +
|
|
|
+ distance * Math.sin((move_angle / 360) * 2 * Math.PI);
|
|
|
+
|
|
|
+ //找到邻居点,判断user.player.position与邻居点的距离,如果距离小于closestDis,就要更新camera的position
|
|
|
+ let chooseBreakPointId = null;
|
|
|
+ const breakPoint = this.breakPointInfo[breakPointId];
|
|
|
+ const surroundPointIds = breakPoint.contact;
|
|
|
+ const traceIds = [];
|
|
|
+
|
|
|
+ user.player.angle.yaw = move_angle;
|
|
|
+ traceIds.push(traceId);
|
|
|
+ this.reply.traceIds = traceIds;
|
|
|
+ this.reply['newUserStates'][0].userId = userId;
|
|
|
+ this.reply['actionResponses'][0].traceId = traceId;
|
|
|
+ this.reply['newUserStates'][0].playerState.player.angle.yaw = move_angle;
|
|
|
+
|
|
|
+ this.reply['newUserStates'][0].playerState.camera.angle = JSON.parse(
|
|
|
+ JSON.stringify(user.camera.angle),
|
|
|
+ );
|
|
|
+ this.reply['newUserStates'][0].playerState.camera.position = JSON.parse(
|
|
|
+ JSON.stringify(user.camera.position),
|
|
|
+ );
|
|
|
+ this.reply['newUserStates'][0].playerState.cameraCenter = JSON.parse(
|
|
|
+ JSON.stringify(breakPoint.position),
|
|
|
+ );
|
|
|
+ this.reply['newUserStates'][0].renderInfo.isMoving = 1;
|
|
|
+ this.reply['actionResponses'][0].traceId = traceId;
|
|
|
+ this.reply.mediaSrc = null;
|
|
|
|
|
|
- user.player.angle.yaw = move_angle;
|
|
|
- traceIds.push(traceId);
|
|
|
- this.reply.traceIds = traceIds;
|
|
|
- this.reply['newUserStates'][0].userId = userId;
|
|
|
- this.reply['actionResponses'][0].traceId = traceId;
|
|
|
- this.reply['newUserStates'][0].playerState.player.angle.yaw = move_angle;
|
|
|
+ console.log('joystickjoystick:' + this.cameraInfos.length);
|
|
|
|
|
|
- this.reply['newUserStates'][0].playerState.camera.angle = JSON.parse(
|
|
|
- JSON.stringify(user.camera.angle),
|
|
|
- );
|
|
|
- this.reply['newUserStates'][0].playerState.camera.position = JSON.parse(
|
|
|
- JSON.stringify(user.camera.position),
|
|
|
+ if (surroundPointIds.length == 1) {
|
|
|
+ console.log(
|
|
|
+ 'joystick校验--->' + breakPointId + '-' + surroundPointIds[0],
|
|
|
);
|
|
|
- this.reply['newUserStates'][0].playerState.cameraCenter = JSON.parse(
|
|
|
- JSON.stringify(breakPoint.position),
|
|
|
+ return await this.moveDirect(
|
|
|
+ playerPosition,
|
|
|
+ closestDis,
|
|
|
+ breakPointId,
|
|
|
+ surroundPointIds[0],
|
|
|
+ appId,
|
|
|
+ userId,
|
|
|
+ traceId,
|
|
|
+ actionType,
|
|
|
);
|
|
|
- this.reply['newUserStates'][0].renderInfo.isMoving = 1;
|
|
|
- this.reply['actionResponses'][0].traceId = traceId;
|
|
|
- this.reply.mediaSrc = null;
|
|
|
+ }
|
|
|
|
|
|
- console.log('joystickjoystick:'+this.cameraInfos.length);
|
|
|
+ let count = 0;
|
|
|
+ const neighPoints = [];
|
|
|
+ //人在哪个角度
|
|
|
+ let _angle = this.getAngle(
|
|
|
+ breakPoint.position,
|
|
|
+ { x: breakPoint.position.x + 1, y: breakPoint.position.y },
|
|
|
+ playerPosition,
|
|
|
+ );
|
|
|
+ if (_angle < 0) {
|
|
|
+ _angle += 360;
|
|
|
+ }
|
|
|
+
|
|
|
+ let singleInfo = null;
|
|
|
+ for (let i = 0; i < surroundPointIds.length; ++i) {
|
|
|
+ const neighPoint = this.breakPointInfo[surroundPointIds[i]];
|
|
|
+ neighPoint.breakPointId = surroundPointIds[i];
|
|
|
+ angle = this.getAngle(
|
|
|
+ breakPoint.position,
|
|
|
+ { x: breakPoint.position.x + 1, y: breakPoint.position.y },
|
|
|
+ neighPoint.position,
|
|
|
+ );
|
|
|
|
|
|
- if (surroundPointIds.length == 1) {
|
|
|
+ //if(angle<45&&angle!=0){
|
|
|
+ if (
|
|
|
+ // Math.abs(angle - move_angle) < 45 &&
|
|
|
+ // Math.abs(angle - move_angle) != 0
|
|
|
+ Math.abs(angle - _angle) < 45 &&
|
|
|
+ Math.abs(angle - _angle) != 0
|
|
|
+ ) {
|
|
|
+ neighPoint.angle = angle;
|
|
|
+ neighPoints.push(neighPoint);
|
|
|
+ ++count;
|
|
|
+ } else if (Math.abs(angle - move_angle) == 0) {
|
|
|
console.log(
|
|
|
- 'joystick校验--->' + breakPointId + '-' + surroundPointIds[0],
|
|
|
+ 'joystick直走--->' + breakPointId + '-' + surroundPointIds[i],
|
|
|
);
|
|
|
return await this.moveDirect(
|
|
|
playerPosition,
|
|
|
closestDis,
|
|
|
breakPointId,
|
|
|
- surroundPointIds[0],
|
|
|
+ surroundPointIds[i],
|
|
|
appId,
|
|
|
userId,
|
|
|
traceId,
|
|
@@ -853,190 +899,141 @@ export class MoveService implements OnModuleInit {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- let count = 0;
|
|
|
- const neighPoints = [];
|
|
|
- //人在哪个角度
|
|
|
- let _angle = this.getAngle(
|
|
|
- breakPoint.position,
|
|
|
- { x: breakPoint.position.x + 1, y: breakPoint.position.y },
|
|
|
- playerPosition,
|
|
|
- );
|
|
|
- if (_angle < 0) {
|
|
|
- _angle += 360;
|
|
|
+ //if (angle == 0 && Math.abs(360 - move_angle) < 45) {
|
|
|
+ if (angle == 0 && Math.abs(360 - _angle) < 45) {
|
|
|
+ neighPoint.angle = angle;
|
|
|
+ neighPoints.push(neighPoint);
|
|
|
+ ++count;
|
|
|
}
|
|
|
|
|
|
- let singleInfo = null;
|
|
|
- for (let i = 0; i < surroundPointIds.length; ++i) {
|
|
|
- const neighPoint = this.breakPointInfo[surroundPointIds[i]];
|
|
|
- neighPoint.breakPointId = surroundPointIds[i];
|
|
|
- angle = this.getAngle(
|
|
|
- breakPoint.position,
|
|
|
- { x: breakPoint.position.x + 1, y: breakPoint.position.y },
|
|
|
- neighPoint.position,
|
|
|
- );
|
|
|
-
|
|
|
- //if(angle<45&&angle!=0){
|
|
|
- if (
|
|
|
- // Math.abs(angle - move_angle) < 45 &&
|
|
|
- // Math.abs(angle - move_angle) != 0
|
|
|
- Math.abs(angle - _angle) < 45 &&
|
|
|
- Math.abs(angle - _angle) != 0
|
|
|
- ) {
|
|
|
- neighPoint.angle = angle;
|
|
|
- neighPoints.push(neighPoint);
|
|
|
- ++count;
|
|
|
- } else if (Math.abs(angle - move_angle) == 0) {
|
|
|
- console.log(
|
|
|
- 'joystick直走--->' + breakPointId + '-' + surroundPointIds[i],
|
|
|
- );
|
|
|
- return await this.moveDirect(
|
|
|
- playerPosition,
|
|
|
- closestDis,
|
|
|
- breakPointId,
|
|
|
- surroundPointIds[i],
|
|
|
- appId,
|
|
|
- userId,
|
|
|
- traceId,
|
|
|
- actionType,
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- //if (angle == 0 && Math.abs(360 - move_angle) < 45) {
|
|
|
- if (angle == 0 && Math.abs(360 - _angle) < 45) {
|
|
|
- neighPoint.angle = angle;
|
|
|
- neighPoints.push(neighPoint);
|
|
|
- ++count;
|
|
|
- }
|
|
|
-
|
|
|
- if (
|
|
|
- Math.abs(angle - move_angle) < 45 ||
|
|
|
- Math.abs(angle + 360 - move_angle) < 45
|
|
|
- ) {
|
|
|
- if (singleInfo == null) {
|
|
|
- singleInfo = {
|
|
|
- angle: angle,
|
|
|
- breakPointId: surroundPointIds[i],
|
|
|
- };
|
|
|
- }
|
|
|
+ if (
|
|
|
+ Math.abs(angle - move_angle) < 45 ||
|
|
|
+ Math.abs(angle + 360 - move_angle) < 45
|
|
|
+ ) {
|
|
|
+ if (singleInfo == null) {
|
|
|
+ singleInfo = {
|
|
|
+ angle: angle,
|
|
|
+ breakPointId: surroundPointIds[i],
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if (count == 2) {
|
|
|
- //人物移动
|
|
|
- user.player.position = JSON.parse(JSON.stringify(playerPosition));
|
|
|
- this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
|
|
|
- JSON.stringify(playerPosition),
|
|
|
+ if (count == 2) {
|
|
|
+ //人物移动
|
|
|
+ user.player.position = JSON.parse(JSON.stringify(playerPosition));
|
|
|
+ this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
|
|
|
+ JSON.stringify(playerPosition),
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ if (singleInfo != null) {
|
|
|
+ console.log(
|
|
|
+ 'joystick校验--->' + breakPointId + '-' + singleInfo.breakPointId,
|
|
|
);
|
|
|
- } else {
|
|
|
- if (singleInfo != null) {
|
|
|
- console.log(
|
|
|
- 'joystick校验--->' + breakPointId + '-' + singleInfo.breakPointId,
|
|
|
- );
|
|
|
- return await this.moveDirect(
|
|
|
- playerPosition,
|
|
|
- closestDis,
|
|
|
- breakPointId,
|
|
|
- singleInfo.breakPointId,
|
|
|
- appId,
|
|
|
- userId,
|
|
|
- traceId,
|
|
|
- actionType,
|
|
|
- );
|
|
|
- } else if (count == 1) {
|
|
|
- console.log(
|
|
|
- 'joystick校验--->' +
|
|
|
- breakPointId +
|
|
|
- '-' +
|
|
|
- neighPoints[0].breakPointId,
|
|
|
- );
|
|
|
- return await this.moveDirect(
|
|
|
- playerPosition,
|
|
|
- closestDis,
|
|
|
- breakPointId,
|
|
|
- neighPoints[0].breakPointId,
|
|
|
- appId,
|
|
|
- userId,
|
|
|
- traceId,
|
|
|
- actionType,
|
|
|
- );
|
|
|
- } else if (count == 0) {
|
|
|
- this.reply['newUserStates'][0].playerState.player.position =
|
|
|
- JSON.parse(JSON.stringify(user.player.position));
|
|
|
- this.reply.actionResponses[0].actionType = actionType;
|
|
|
- return this.reply;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //count == 2
|
|
|
- //超出范围了
|
|
|
- if (this.getDistance(playerPosition, breakPoint.position) > closestDis) {
|
|
|
- let offsetAngle1 = Math.abs(_angle - neighPoints[0].angle);
|
|
|
- if (neighPoints[0].angle == 0) {
|
|
|
- offsetAngle1 = Math.min(offsetAngle1, Math.abs(_angle - 360));
|
|
|
- }
|
|
|
-
|
|
|
- let offsetAngle2 = Math.abs(_angle - neighPoints[1].angle);
|
|
|
- if (neighPoints[1].angle == 0) {
|
|
|
- offsetAngle2 = Math.min(offsetAngle2, Math.abs(_angle - 360));
|
|
|
- }
|
|
|
-
|
|
|
- if (offsetAngle1 > offsetAngle2) {
|
|
|
- chooseBreakPointId = neighPoints[1].breakPointId;
|
|
|
- } else {
|
|
|
- chooseBreakPointId = neighPoints[0].breakPointId;
|
|
|
- }
|
|
|
+ return await this.moveDirect(
|
|
|
+ playerPosition,
|
|
|
+ closestDis,
|
|
|
+ breakPointId,
|
|
|
+ singleInfo.breakPointId,
|
|
|
+ appId,
|
|
|
+ userId,
|
|
|
+ traceId,
|
|
|
+ actionType,
|
|
|
+ );
|
|
|
+ } else if (count == 1) {
|
|
|
console.log(
|
|
|
- 'joystick镜头过渡--->' + breakPointId + '-' + chooseBreakPointId,
|
|
|
+ 'joystick校验--->' + breakPointId + '-' + neighPoints[0].breakPointId,
|
|
|
);
|
|
|
- return await this.moveCamera(
|
|
|
+ return await this.moveDirect(
|
|
|
+ playerPosition,
|
|
|
+ closestDis,
|
|
|
breakPointId,
|
|
|
- chooseBreakPointId,
|
|
|
+ neighPoints[0].breakPointId,
|
|
|
appId,
|
|
|
userId,
|
|
|
traceId,
|
|
|
actionType,
|
|
|
);
|
|
|
- } else {
|
|
|
- user.player.position = JSON.parse(JSON.stringify(playerPosition));
|
|
|
+ } else if (count == 0) {
|
|
|
this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
|
|
|
JSON.stringify(user.player.position),
|
|
|
);
|
|
|
this.reply.actionResponses[0].actionType = actionType;
|
|
|
- const cameraInfo = this.getCameraInfo();
|
|
|
- if (cameraInfo != null) {
|
|
|
- console.log('joystick自由--->合并');
|
|
|
- this.reply['newUserStates'][0].playerState.camera.position = cameraInfo.camera_position;
|
|
|
- this.reply['newUserStates'][0].playerState.camera.angle = cameraInfo.camera_angle;
|
|
|
-
|
|
|
- if (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){
|
|
|
- this.reply.moveOver = true;
|
|
|
- }
|
|
|
- this.sendingFrameForJoystick = true;
|
|
|
- } else {
|
|
|
- console.log('joystick自由--->不合并');
|
|
|
- }
|
|
|
return this.reply;
|
|
|
}
|
|
|
- // }
|
|
|
+ }
|
|
|
+
|
|
|
+ //count == 2
|
|
|
+ //超出范围了
|
|
|
+ if (this.getDistance(playerPosition, breakPoint.position) > closestDis) {
|
|
|
+ let offsetAngle1 = Math.abs(_angle - neighPoints[0].angle);
|
|
|
+ if (neighPoints[0].angle == 0) {
|
|
|
+ offsetAngle1 = Math.min(offsetAngle1, Math.abs(_angle - 360));
|
|
|
+ }
|
|
|
+
|
|
|
+ let offsetAngle2 = Math.abs(_angle - neighPoints[1].angle);
|
|
|
+ if (neighPoints[1].angle == 0) {
|
|
|
+ offsetAngle2 = Math.min(offsetAngle2, Math.abs(_angle - 360));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (offsetAngle1 > offsetAngle2) {
|
|
|
+ chooseBreakPointId = neighPoints[1].breakPointId;
|
|
|
+ } else {
|
|
|
+ chooseBreakPointId = neighPoints[0].breakPointId;
|
|
|
+ }
|
|
|
+ console.log(
|
|
|
+ 'joystick镜头过渡--->' + breakPointId + '-' + chooseBreakPointId,
|
|
|
+ );
|
|
|
+ return await this.moveCamera(
|
|
|
+ breakPointId,
|
|
|
+ chooseBreakPointId,
|
|
|
+ appId,
|
|
|
+ userId,
|
|
|
+ traceId,
|
|
|
+ actionType,
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ user.player.position = JSON.parse(JSON.stringify(playerPosition));
|
|
|
+ this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
|
|
|
+ JSON.stringify(user.player.position),
|
|
|
+ );
|
|
|
+ this.reply.actionResponses[0].actionType = actionType;
|
|
|
+ const cameraInfo = this.getCameraInfo();
|
|
|
+ if (cameraInfo != null) {
|
|
|
+ console.log('joystick自由--->合并');
|
|
|
+ this.reply['newUserStates'][0].playerState.camera.position =
|
|
|
+ cameraInfo.camera_position;
|
|
|
+ this.reply['newUserStates'][0].playerState.camera.angle =
|
|
|
+ cameraInfo.camera_angle;
|
|
|
+
|
|
|
+ if (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) {
|
|
|
+ this.reply.moveOver = true;
|
|
|
+ }
|
|
|
+ this.sendingFrameForJoystick = true;
|
|
|
+ } else {
|
|
|
+ console.log('joystick自由--->不合并');
|
|
|
+ }
|
|
|
+ return this.reply;
|
|
|
+ }
|
|
|
+ // }
|
|
|
// catch (error) {
|
|
|
// console.log('MoveService', error);
|
|
|
// debugger;
|
|
@@ -1057,7 +1054,7 @@ export class MoveService implements OnModuleInit {
|
|
|
) {
|
|
|
const breakPoint = this.breakPointInfo[breakPointId];
|
|
|
const user = this.users[userId];
|
|
|
- let player_Position = this.getTarget(
|
|
|
+ const player_Position = this.getTarget(
|
|
|
playerPosition,
|
|
|
breakPoint.position,
|
|
|
this.breakPointInfo[neighBreakPointId].position,
|
|
@@ -1085,13 +1082,14 @@ export class MoveService implements OnModuleInit {
|
|
|
this.reply.actionResponses[0].actionType = actionType;
|
|
|
const cameraInfo = this.getCameraInfo();
|
|
|
if (cameraInfo != null) {
|
|
|
- this.reply['newUserStates'][0].playerState.camera.position = cameraInfo.camera_position;
|
|
|
- this.reply['newUserStates'][0].playerState.camera.angle = cameraInfo.camera_angle;
|
|
|
-
|
|
|
+ this.reply['newUserStates'][0].playerState.camera.position =
|
|
|
+ cameraInfo.camera_position;
|
|
|
+ this.reply['newUserStates'][0].playerState.camera.angle =
|
|
|
+ cameraInfo.camera_angle;
|
|
|
+
|
|
|
if (cameraInfo.mediaSrc) {
|
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
|
- }
|
|
|
- else if (cameraInfo.file_name) {
|
|
|
+ } else if (cameraInfo.file_name) {
|
|
|
this.reply.mediaSrc =
|
|
|
'/' +
|
|
|
appId +
|
|
@@ -1108,7 +1106,7 @@ export class MoveService implements OnModuleInit {
|
|
|
new Date().getTime();
|
|
|
}
|
|
|
|
|
|
- if(this.cameraInfos.length == 0){
|
|
|
+ if (this.cameraInfos.length == 0) {
|
|
|
this.reply.moveOver = true;
|
|
|
}
|
|
|
this.sendingFrameForJoystick = true;
|
|
@@ -1229,7 +1227,7 @@ export class MoveService implements OnModuleInit {
|
|
|
}
|
|
|
|
|
|
setCameraInfo(moveFrames) {
|
|
|
- for(let i=0;i<moveFrames.length;i += 5){
|
|
|
+ for (let i = 0; i < moveFrames.length; i += 5) {
|
|
|
this.cameraInfos.push(moveFrames[i]);
|
|
|
}
|
|
|
}
|