|
@@ -12,8 +12,8 @@ import configuration from 'src/config/configuration';
|
|
|
|
|
|
const MaxDelayTime = 80; //超过这个值就需要干预(操作杆)
|
|
|
const MaxBufferCameraInfo = 3; //超过这个值就需要干预(操作杆)
|
|
|
-const MaxNet = 3;
|
|
|
-const MaxWalkCount = 20;
|
|
|
+const MaxNet = 30000000;
|
|
|
+const MaxWalkCount = 2;
|
|
|
|
|
|
const seqExeAsyncFn = (asyncFn) => {
|
|
|
let runPromise = null;
|
|
@@ -685,6 +685,7 @@ export class MoveService implements OnModuleInit {
|
|
|
const breakPointId = user.breakPointId;
|
|
|
const appId = user.appId;
|
|
|
const replys = [];
|
|
|
+ console.log('joystickActionRequest=>'+traceId+'_'+new Date().getTime());
|
|
|
let step = 0.4;
|
|
|
if(user.walkState>MaxWalkCount){
|
|
|
step = 1.2;
|
|
@@ -788,21 +789,37 @@ export class MoveService implements OnModuleInit {
|
|
|
}
|
|
|
}
|
|
|
console.log('joystickjoystick:' + this.cameraInfos.length);
|
|
|
+ this.reply.actionResponses[0].actionType = actionType;
|
|
|
//超出范围了
|
|
|
if (this.getDistance(playerPosition, breakPoint.position) > closestDis) {
|
|
|
- return await this.moveCamera(
|
|
|
- breakPointId,
|
|
|
- closestNeighorId,
|
|
|
- appId,
|
|
|
- userId,
|
|
|
- traceId,
|
|
|
- actionType,
|
|
|
- );
|
|
|
+ if (user.lastJoyStickMediaSrc) {
|
|
|
+ user.player.position = JSON.parse(JSON.stringify(playerPosition));
|
|
|
+ this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
|
|
|
+ JSON.stringify(user.player.position),
|
|
|
+ );
|
|
|
+ user.lastJoyStickMediaSrc = false;
|
|
|
+ console.log('joystickActionRequest_1=>'+traceId+'_'+new Date().getTime());
|
|
|
+ return this.reply;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ return await this.moveCamera(
|
|
|
+ breakPointId,
|
|
|
+ closestNeighorId,
|
|
|
+ appId,
|
|
|
+ userId,
|
|
|
+ traceId,
|
|
|
+ actionType,
|
|
|
+ );
|
|
|
+ }
|
|
|
} else {
|
|
|
const inside = this.isPointInPoly(playerPosition, area);
|
|
|
//超出区域
|
|
|
if (!inside) {
|
|
|
if (minAngleNeighorId != null) {
|
|
|
+ if (user.lastJoyStickMediaSrc) {
|
|
|
+ user.lastJoyStickMediaSrc = false;
|
|
|
+ return null;
|
|
|
+ }
|
|
|
return await this.moveDirect(
|
|
|
playerPosition,
|
|
|
closestDis,
|
|
@@ -822,10 +839,9 @@ export class MoveService implements OnModuleInit {
|
|
|
this.reply['newUserStates'][0].playerState.player.position = JSON.parse(
|
|
|
JSON.stringify(user.player.position),
|
|
|
);
|
|
|
- this.reply.actionResponses[0].actionType = actionType;
|
|
|
|
|
|
console.log('20220719_延时->' + time_delay);
|
|
|
- // //网络延迟的情况下,就暂时不推流
|
|
|
+ //网络延迟的情况下,就暂时不推流
|
|
|
if (
|
|
|
time_delay &&
|
|
|
time_delay < MaxDelayTime &&
|
|
@@ -840,9 +856,11 @@ export class MoveService implements OnModuleInit {
|
|
|
if (user.netQua < MaxNet) {
|
|
|
if (user.lastJoyStickMediaSrc) {
|
|
|
user.lastJoyStickMediaSrc = false;
|
|
|
+ console.log('joystickActionRequest_1=>'+traceId+'_'+new Date().getTime());
|
|
|
return this.reply;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
const cameraInfo = this.getCameraInfo();
|
|
|
if (cameraInfo != null) {
|
|
|
this.reply['newUserStates'][0].playerState.camera.position =
|
|
@@ -853,6 +871,7 @@ export class MoveService implements OnModuleInit {
|
|
|
if (cameraInfo.mediaSrc) {
|
|
|
this.reply.mediaSrc = cameraInfo.mediaSrc;
|
|
|
this.reply.isIDR = cameraInfo.isIDR;
|
|
|
+ console.log('joystickActionRequest_2=>'+traceId+'_'+new Date().getTime());
|
|
|
user.lastJoyStickMediaSrc = true;
|
|
|
}
|
|
|
|
|
@@ -1439,6 +1458,7 @@ export class MoveService implements OnModuleInit {
|
|
|
}
|
|
|
|
|
|
complementFrame(userId) {
|
|
|
+ debugger;
|
|
|
const user = this.users[userId];
|
|
|
user.walkState = 0;
|
|
|
user.IDRCount = 0;
|