diff --git a/src/graphics/tccHandle/TccHandle.ts b/src/graphics/tccHandle/TccHandle.ts index 9a9ee93..03330fd 100644 --- a/src/graphics/tccHandle/TccHandle.ts +++ b/src/graphics/tccHandle/TccHandle.ts @@ -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(); } 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; } } diff --git a/src/protos/common_data.ts b/src/protos/common_data.ts index 47810d5..eabf075 100644 --- a/src/protos/common_data.ts +++ b/src/protos/common_data.ts @@ -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(); } } diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index a491e92..5c3c44c 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -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(); } } diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 38af44f..c95b09b 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -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; 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; 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(); } } diff --git a/src/stores/tcc-store.ts b/src/stores/tcc-store.ts index 9bbbab9..3b85023 100644 --- a/src/stores/tcc-store.ts +++ b/src/stores/tcc-store.ts @@ -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(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,