Squashed commit of the following:
All checks were successful
CI / Docker-Build (push) Successful in 2m37s

commit e39774e4bc
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Thu Aug 29 17:27:47 2024 +0800

    驾驶台手柄0位范围扩大,在范围内自动吸附到0位

commit f61ee0610c
Author: fan <fanyuhong@joylink.club>
Date:   Thu Aug 29 16:55:59 2024 +0800

    proto同步

commit 3c856ec37c
Author: fan <fanyuhong@joylink.club>
Date:   Thu Aug 29 16:14:30 2024 +0800

    protoc同步

commit 0ac19e5d35
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Tue Aug 27 11:44:09 2024 +0800

    修改请求参数(门模式)

commit 8f9c0c852a
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Thu Aug 22 14:31:15 2024 +0800

    驾驶台旋钮操作bug修复
This commit is contained in:
joylink_zhaoerwei 2024-08-29 17:30:26 +08:00
parent aadebddbad
commit 87b600fed5
5 changed files with 160 additions and 26 deletions

View File

@ -9,6 +9,7 @@ import Tcc_Handle_JSON from './tcc-handle-data.json';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
export const zeroOffset = 9;
interface TccHandleTextures {
tccHandle: Texture;
handleBackground: Texture;
@ -54,7 +55,14 @@ export class TccHandle extends JlGraphic {
return this.getStates<ITccHandleState>();
}
doRepaint(): void {
this._tccHandle.y = -(this.state.gear * 144) / 100;
const pos = -(this.state.gear * (144 - zeroOffset)) / 100;
if (pos > 0) {
this._tccHandle.y = pos + zeroOffset;
} else if (pos < 0) {
this._tccHandle.y = pos - zeroOffset;
} else {
this._tccHandle.y = 0;
}
this._tccHandle.texture = this.tccHandleTextures.tccHandle;
}
}

View File

@ -25,7 +25,6 @@ export namespace common {
idlingD?: number;
stopSign?: number;
slide?: number;
trainLoad?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -81,9 +80,6 @@ export namespace common {
if ("slide" in data && data.slide != undefined) {
this.slide = data.slide;
}
if ("trainLoad" in data && data.trainLoad != undefined) {
this.trainLoad = data.trainLoad;
}
}
}
get davisParamA() {
@ -188,12 +184,6 @@ export namespace common {
set slide(value: number) {
pb_1.Message.setField(this, 18, value);
}
get trainLoad() {
return pb_1.Message.getFieldWithDefault(this, 19, 0) as number;
}
set trainLoad(value: number) {
pb_1.Message.setField(this, 19, value);
}
static fromObject(data: {
davisParamA?: number;
davisParamB?: number;
@ -212,7 +202,6 @@ export namespace common {
idlingD?: number;
stopSign?: number;
slide?: number;
trainLoad?: number;
}): TrainDynamicConfig {
const message = new TrainDynamicConfig({});
if (data.davisParamA != null) {
@ -266,9 +255,6 @@ export namespace common {
if (data.slide != null) {
message.slide = data.slide;
}
if (data.trainLoad != null) {
message.trainLoad = data.trainLoad;
}
return message;
}
toObject() {
@ -290,7 +276,6 @@ export namespace common {
idlingD?: number;
stopSign?: number;
slide?: number;
trainLoad?: number;
} = {};
if (this.davisParamA != null) {
data.davisParamA = this.davisParamA;
@ -343,9 +328,6 @@ export namespace common {
if (this.slide != null) {
data.slide = this.slide;
}
if (this.trainLoad != null) {
data.trainLoad = this.trainLoad;
}
return data;
}
serialize(): Uint8Array;
@ -386,8 +368,6 @@ export namespace common {
writer.writeInt32(17, this.stopSign);
if (this.slide != 0)
writer.writeFloat(18, this.slide);
if (this.trainLoad != 0)
writer.writeInt32(19, this.trainLoad);
if (!w)
return writer.getResultBuffer();
}
@ -448,9 +428,6 @@ export namespace common {
case 18:
message.slide = reader.readFloat();
break;
case 19:
message.trainLoad = reader.readInt32();
break;
default: reader.skipField();
}
}

View File

@ -3388,6 +3388,8 @@ export namespace state {
lightDir2?: boolean;
lightDriverActive?: boolean;
trainConnInitComplate?: boolean;
atoCloseRightDoor?: boolean;
lightAtoSend?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -3626,6 +3628,12 @@ export namespace state {
if ("trainConnInitComplate" in data && data.trainConnInitComplate != undefined) {
this.trainConnInitComplate = data.trainConnInitComplate;
}
if ("atoCloseRightDoor" in data && data.atoCloseRightDoor != undefined) {
this.atoCloseRightDoor = data.atoCloseRightDoor;
}
if ("lightAtoSend" in data && data.lightAtoSend != undefined) {
this.lightAtoSend = data.lightAtoSend;
}
}
}
get lifeSignal() {
@ -4096,6 +4104,18 @@ export namespace state {
set trainConnInitComplate(value: boolean) {
pb_1.Message.setField(this, 82, value);
}
get atoCloseRightDoor() {
return pb_1.Message.getFieldWithDefault(this, 83, false) as boolean;
}
set atoCloseRightDoor(value: boolean) {
pb_1.Message.setField(this, 83, value);
}
get lightAtoSend() {
return pb_1.Message.getFieldWithDefault(this, 84, false) as boolean;
}
set lightAtoSend(value: boolean) {
pb_1.Message.setField(this, 84, value);
}
static fromObject(data: {
lifeSignal?: number;
tc1Active?: boolean;
@ -4175,6 +4195,8 @@ export namespace state {
lightDir2?: boolean;
lightDriverActive?: boolean;
trainConnInitComplate?: boolean;
atoCloseRightDoor?: boolean;
lightAtoSend?: boolean;
}): TrainVobcState {
const message = new TrainVobcState({});
if (data.lifeSignal != null) {
@ -4411,6 +4433,12 @@ export namespace state {
if (data.trainConnInitComplate != null) {
message.trainConnInitComplate = data.trainConnInitComplate;
}
if (data.atoCloseRightDoor != null) {
message.atoCloseRightDoor = data.atoCloseRightDoor;
}
if (data.lightAtoSend != null) {
message.lightAtoSend = data.lightAtoSend;
}
return message;
}
toObject() {
@ -4493,6 +4521,8 @@ export namespace state {
lightDir2?: boolean;
lightDriverActive?: boolean;
trainConnInitComplate?: boolean;
atoCloseRightDoor?: boolean;
lightAtoSend?: boolean;
} = {};
if (this.lifeSignal != null) {
data.lifeSignal = this.lifeSignal;
@ -4728,6 +4758,12 @@ export namespace state {
if (this.trainConnInitComplate != null) {
data.trainConnInitComplate = this.trainConnInitComplate;
}
if (this.atoCloseRightDoor != null) {
data.atoCloseRightDoor = this.atoCloseRightDoor;
}
if (this.lightAtoSend != null) {
data.lightAtoSend = this.lightAtoSend;
}
return data;
}
serialize(): Uint8Array;
@ -4890,6 +4926,10 @@ export namespace state {
writer.writeBool(81, this.lightDriverActive);
if (this.trainConnInitComplate != false)
writer.writeBool(82, this.trainConnInitComplate);
if (this.atoCloseRightDoor != false)
writer.writeBool(83, this.atoCloseRightDoor);
if (this.lightAtoSend != false)
writer.writeBool(84, this.lightAtoSend);
if (!w)
return writer.getResultBuffer();
}
@ -5133,6 +5173,12 @@ export namespace state {
case 82:
message.trainConnInitComplate = reader.readBool();
break;
case 83:
message.atoCloseRightDoor = reader.readBool();
break;
case 84:
message.lightAtoSend = reader.readBool();
break;
default: reader.skipField();
}
}

View File

@ -9084,6 +9084,10 @@ export namespace graphicData {
trainSets?: string;
dynamicConfig?: dependency_1.common.TrainDynamicConfig;
trainControlMapId?: number;
trainLoad?: number;
trainMaxSpeed?: number;
trainMaxAcc?: number;
trainMaxBrake?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -9106,6 +9110,18 @@ export namespace graphicData {
if ("trainControlMapId" in data && data.trainControlMapId != undefined) {
this.trainControlMapId = data.trainControlMapId;
}
if ("trainLoad" in data && data.trainLoad != undefined) {
this.trainLoad = data.trainLoad;
}
if ("trainMaxSpeed" in data && data.trainMaxSpeed != undefined) {
this.trainMaxSpeed = data.trainMaxSpeed;
}
if ("trainMaxAcc" in data && data.trainMaxAcc != undefined) {
this.trainMaxAcc = data.trainMaxAcc;
}
if ("trainMaxBrake" in data && data.trainMaxBrake != undefined) {
this.trainMaxBrake = data.trainMaxBrake;
}
}
}
get trainModel() {
@ -9147,6 +9163,30 @@ export namespace graphicData {
set trainControlMapId(value: number) {
pb_1.Message.setField(this, 9, value);
}
get trainLoad() {
return pb_1.Message.getFieldWithDefault(this, 10, 0) as number;
}
set trainLoad(value: number) {
pb_1.Message.setField(this, 10, value);
}
get trainMaxSpeed() {
return pb_1.Message.getFieldWithDefault(this, 11, 0) as number;
}
set trainMaxSpeed(value: number) {
pb_1.Message.setField(this, 11, value);
}
get trainMaxAcc() {
return pb_1.Message.getFieldWithDefault(this, 12, 0) as number;
}
set trainMaxAcc(value: number) {
pb_1.Message.setField(this, 12, value);
}
get trainMaxBrake() {
return pb_1.Message.getFieldWithDefault(this, 13, 0) as number;
}
set trainMaxBrake(value: number) {
pb_1.Message.setField(this, 13, value);
}
static fromObject(data: {
trainModel?: Train.TrainModel;
carriageLength?: number;
@ -9154,6 +9194,10 @@ export namespace graphicData {
trainSets?: string;
dynamicConfig?: ReturnType<typeof dependency_1.common.TrainDynamicConfig.prototype.toObject>;
trainControlMapId?: number;
trainLoad?: number;
trainMaxSpeed?: number;
trainMaxAcc?: number;
trainMaxBrake?: number;
}): Train {
const message = new Train({});
if (data.trainModel != null) {
@ -9174,6 +9218,18 @@ export namespace graphicData {
if (data.trainControlMapId != null) {
message.trainControlMapId = data.trainControlMapId;
}
if (data.trainLoad != null) {
message.trainLoad = data.trainLoad;
}
if (data.trainMaxSpeed != null) {
message.trainMaxSpeed = data.trainMaxSpeed;
}
if (data.trainMaxAcc != null) {
message.trainMaxAcc = data.trainMaxAcc;
}
if (data.trainMaxBrake != null) {
message.trainMaxBrake = data.trainMaxBrake;
}
return message;
}
toObject() {
@ -9184,6 +9240,10 @@ export namespace graphicData {
trainSets?: string;
dynamicConfig?: ReturnType<typeof dependency_1.common.TrainDynamicConfig.prototype.toObject>;
trainControlMapId?: number;
trainLoad?: number;
trainMaxSpeed?: number;
trainMaxAcc?: number;
trainMaxBrake?: number;
} = {};
if (this.trainModel != null) {
data.trainModel = this.trainModel;
@ -9203,6 +9263,18 @@ export namespace graphicData {
if (this.trainControlMapId != null) {
data.trainControlMapId = this.trainControlMapId;
}
if (this.trainLoad != null) {
data.trainLoad = this.trainLoad;
}
if (this.trainMaxSpeed != null) {
data.trainMaxSpeed = this.trainMaxSpeed;
}
if (this.trainMaxAcc != null) {
data.trainMaxAcc = this.trainMaxAcc;
}
if (this.trainMaxBrake != null) {
data.trainMaxBrake = this.trainMaxBrake;
}
return data;
}
serialize(): Uint8Array;
@ -9221,6 +9293,14 @@ export namespace graphicData {
writer.writeMessage(7, this.dynamicConfig, () => this.dynamicConfig.serialize(writer));
if (this.trainControlMapId != 0)
writer.writeInt32(9, this.trainControlMapId);
if (this.trainLoad != 0)
writer.writeInt32(10, this.trainLoad);
if (this.trainMaxSpeed != 0)
writer.writeFloat(11, this.trainMaxSpeed);
if (this.trainMaxAcc != 0)
writer.writeFloat(12, this.trainMaxAcc);
if (this.trainMaxBrake != 0)
writer.writeFloat(13, this.trainMaxBrake);
if (!w)
return writer.getResultBuffer();
}
@ -9248,6 +9328,18 @@ export namespace graphicData {
case 9:
message.trainControlMapId = reader.readInt32();
break;
case 10:
message.trainLoad = reader.readInt32();
break;
case 11:
message.trainMaxSpeed = reader.readFloat();
break;
case 12:
message.trainMaxAcc = reader.readFloat();
break;
case 13:
message.trainMaxBrake = reader.readFloat();
break;
default: reader.skipField();
}
}

View File

@ -5,7 +5,7 @@ import { useLineStore } from './line-store';
import { tccOperation } from 'src/api/Simulation';
import { errorNotify } from 'src/utils/CommonNotify';
import { request } from 'src/protos/request';
import { TccHandle } from 'src/graphics/tccHandle/TccHandle';
import { TccHandle, zeroOffset } from 'src/graphics/tccHandle/TccHandle';
import { TccKey } from 'src/graphics/tccKey/TccKey';
import { IGraphicApp } from 'jl-graphic';
@ -47,8 +47,19 @@ export const useTccStore = defineStore('tcc', {
.getScene(`tcc${this.tccId}`)
.queryStore.queryById<TccHandle>(this.tccHandleId);
if (!simulationId) return;
let transFormHandleVal = 0;
if (
tccHandle._tccHandle.y >= -zeroOffset &&
tccHandle._tccHandle.y <= zeroOffset
) {
tccHandle._tccHandle.y = 0;
} else if (tccHandle._tccHandle.y < -zeroOffset) {
transFormHandleVal = tccHandle._tccHandle.y + zeroOffset;
} else {
transFormHandleVal = tccHandle._tccHandle.y - zeroOffset;
}
const handleVal = Number(
(-(tccHandle._tccHandle.y / 144) * 100).toFixed()
(-(transFormHandleVal / (144 - zeroOffset)) * 100).toFixed()
);
tccOperation({
simulationId,