|
@@ -4,6 +4,7 @@ import { readFileSync } from 'fs';
|
|
|
import { join } from 'path';
|
|
|
import { CacheService } from 'src/cache/cache.service';
|
|
|
import { RotateService } from 'src/rotate/rotate.service';
|
|
|
+import configuration from 'src/config/configuration';
|
|
|
|
|
|
// import * as BreakPointIds from '../../ws/points-BreakPointId.json';
|
|
|
// import { SceneService } from 'src/scene/scene.service';
|
|
@@ -32,7 +33,7 @@ export class MoveService implements OnModuleInit {
|
|
|
private cacheService: CacheService,
|
|
|
private rotateService: RotateService,
|
|
|
private configService: ConfigService,
|
|
|
- ) {}
|
|
|
+ ) { }
|
|
|
private logger: Logger = new Logger('MoveService');
|
|
|
private Actions = {
|
|
|
Clicking: 1,
|
|
@@ -136,17 +137,22 @@ export class MoveService implements OnModuleInit {
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
|
async onModuleInit() {
|
|
|
//const app_id = '0000000003';
|
|
|
- const app_id = '0000000007';
|
|
|
- const prefix = '/mnt/metaverse/scene';
|
|
|
+ // const app_id = '0000000007';
|
|
|
+ // const prefix = '/mnt/metaverse/scene';
|
|
|
+ const app_id = configuration().app.appId;
|
|
|
+ const prefix = configuration().app.prefix;
|
|
|
+ console.log('app_id', app_id, configuration().app.appId);
|
|
|
+ console.log('prefix', prefix, configuration().app.appId);
|
|
|
+
|
|
|
let path;
|
|
|
// let path: string;
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
path = join(__dirname, `../ws/${app_id}/points-${app_id}.json`);
|
|
|
- console.log('测试服JSON', path);
|
|
|
+ console.log('测试服JSON-move', path);
|
|
|
}
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
path = join(`${prefix}/${app_id}/points-${app_id}.json`);
|
|
|
- console.log('正式服JSON', path);
|
|
|
+ console.log('正式服JSON-move', path);
|
|
|
}
|
|
|
this.loadJSON(path);
|
|
|
}
|
|
@@ -207,9 +213,9 @@ export class MoveService implements OnModuleInit {
|
|
|
angleIndex,
|
|
|
) {
|
|
|
|
|
|
- if(angleIndex<0){
|
|
|
+ if (angleIndex < 0) {
|
|
|
debugger;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
let moveFramesRes, moveFrames;
|
|
|
let key =
|
|
@@ -1367,20 +1373,20 @@ export class MoveService implements OnModuleInit {
|
|
|
user.camera.position = JSON.parse(
|
|
|
JSON.stringify(cameraInfo.camera_position),
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
user.camera.angle = JSON.parse(
|
|
|
JSON.stringify(cameraInfo.camera_angle),
|
|
|
);
|
|
|
|
|
|
this.sendingFrameForJoystick = true;
|
|
|
return this.reply;
|
|
|
- }
|
|
|
- else if (this.cameraInfos.length == 0){
|
|
|
- if(this.reply['newUserStates'][0].renderInfo.isMoving == 1){
|
|
|
+ }
|
|
|
+ else if (this.cameraInfos.length == 0) {
|
|
|
+ if (this.reply['newUserStates'][0].renderInfo.isMoving == 1) {
|
|
|
//console.log('handlejoysticktesttest:complementFrame-2 停止1'+new Date().getTime())
|
|
|
return this.stopJoystick(userId)
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
//console.log('handlejoysticktesttest:complementFrame-2 停止2'+new Date().getTime())
|
|
|
return null;
|
|
|
}
|
|
@@ -1445,7 +1451,7 @@ export class MoveService implements OnModuleInit {
|
|
|
);
|
|
|
this.reply['newUserStates'][0].playerState.camera.position = JSON.parse(
|
|
|
JSON.stringify(user.camera.position),
|
|
|
- );
|
|
|
+ );
|
|
|
|
|
|
this.reply['newUserStates'][0].playerState.cameraCenter = JSON.parse(
|
|
|
JSON.stringify(user.player.position),
|
|
@@ -1511,7 +1517,7 @@ export class MoveService implements OnModuleInit {
|
|
|
getDistance(position1, position2) {
|
|
|
return Math.sqrt(
|
|
|
(position1.x - position2.x) * (position1.x - position2.x) +
|
|
|
- (position1.y - position2.y) * (position1.y - position2.y),
|
|
|
+ (position1.y - position2.y) * (position1.y - position2.y),
|
|
|
);
|
|
|
}
|
|
|
|