From 602baee71517bfeef8e1bdbf053c23e865a9d524 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Sat, 13 Nov 2021 14:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=A0=87=E7=BB=98=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=86=85=E8=A7=86=E8=A7=92=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../babylon/model/data/mark/all-mark-data.ts | 2 +- .../babylon/model/data/mark/mark-plan-data.ts | 5 ++++ src/app/babylon/tool/speaking-tool.ts | 11 ++++++++ .../view/building-window/building-window.ts | 24 ++++++++++++++--- .../babylon/view/mark-window/mark-window.ts | 27 +++++++++++++++---- 5 files changed, 59 insertions(+), 10 deletions(-) diff --git a/src/app/babylon/model/data/mark/all-mark-data.ts b/src/app/babylon/model/data/mark/all-mark-data.ts index e6dcad2..9481cca 100644 --- a/src/app/babylon/model/data/mark/all-mark-data.ts +++ b/src/app/babylon/model/data/mark/all-mark-data.ts @@ -16,7 +16,7 @@ export class AllMarkData { marks_Disaster: MarkData[] = []; /** - * 消防力量 + * 外部力量 */ @Type(() => MarkData) marks_Outside: MarkData[] = []; diff --git a/src/app/babylon/model/data/mark/mark-plan-data.ts b/src/app/babylon/model/data/mark/mark-plan-data.ts index 1e4e751..2613eaa 100644 --- a/src/app/babylon/model/data/mark/mark-plan-data.ts +++ b/src/app/babylon/model/data/mark/mark-plan-data.ts @@ -213,6 +213,11 @@ export class MarkNodeData { @Type(() => ArcRotateCameraData) cameraData: ArcRotateCameraData; + /** + * 展示罩棚 + */ + showZP: boolean; + /** * 所处环境的信息 */ diff --git a/src/app/babylon/tool/speaking-tool.ts b/src/app/babylon/tool/speaking-tool.ts index 5fb710b..eb33fd5 100644 --- a/src/app/babylon/tool/speaking-tool.ts +++ b/src/app/babylon/tool/speaking-tool.ts @@ -16,6 +16,7 @@ export class SpeakingTool { /** * 阅读一段文字 + * 会清空已有的阅读列表 * @param msg */ speak(msg: string) { @@ -23,6 +24,9 @@ export class SpeakingTool { } else { + + this.clear(); + let speakMsg = new SpeechSynthesisUtterance(msg); speakMsg.lang = "zh-CN"; speakMsg.rate = 1; @@ -47,6 +51,13 @@ export class SpeakingTool { window.speechSynthesis.resume(); } + /** + * 清空进行中的阅读 + */ + clear() { + window.speechSynthesis.cancel(); + } + /** * IE浏览器 */ diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index 8df21a8..485c347 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -9,6 +9,7 @@ import { SceneManager } from "../../controller/scene-manager"; import { ServeManager } from "../../controller/serve-manager"; import { BuildingStatus } from "../../controller/status/building-status"; import { StatusManager } from "../../controller/status/status-manager"; +import { ArcRotateCameraData } from "../../model/data/camera-data"; import { BuildingData, BuildingData_ChemicalPlant, BuildingData_Environment, BuildingData_Normal, BuildingType } from "../../model/data/institution/building/building-data"; import { JYZInfoMoudleType, JYZShowData } from "../../model/data/institution/jyz-show-data"; import { ModelType } from "../../model/data/model-data/model-data"; @@ -264,16 +265,31 @@ export class BuildingWindow extends UIBase { recoverMoudleShow(type: JYZInfoMoudleType) { let showData = DataManager.institutionData.getMoudleShowData(type); if (showData != null) { - let camera = SceneManager.Instance.defaultCamera; + //let camera = SceneManager.Instance.defaultCamera; //showData.cameraData.setDataToCamera(camera); let cameraData = showData.cameraData; - BabylonTool.AnimMoveCameraTargetAB(camera, 60, cameraData.target, cameraData.radius, cameraData.alpha, cameraData.beta); - this.showZP(showData.showZP); - PlanComponent.instance.isOpenAwning = showData.showZP; + // BabylonTool.AnimMoveCameraTargetAB(camera, 60, cameraData.target, cameraData.radius, cameraData.alpha, cameraData.beta); + // this.showZP(showData.showZP); + // PlanComponent.instance.isOpenAwning = showData.showZP; + this.revoverCamera(cameraData, showData.showZP); } } + /** + * 动画恢复相机状态 + * @param cameraData + * @param showZP + */ + revoverCamera(cameraData: ArcRotateCameraData, showZP: boolean) { + this.showZP(showZP); + PlanComponent.instance.isOpenAwning = showZP; + let camera = SceneManager.Instance.defaultCamera; + if (cameraData != null) { + BabylonTool.AnimMoveCameraTargetAB(camera, 60, cameraData.target, cameraData.radius, cameraData.alpha, cameraData.beta); + } + } + //#endregion diff --git a/src/app/babylon/view/mark-window/mark-window.ts b/src/app/babylon/view/mark-window/mark-window.ts index 533c761..bc942e5 100644 --- a/src/app/babylon/view/mark-window/mark-window.ts +++ b/src/app/babylon/view/mark-window/mark-window.ts @@ -1,5 +1,5 @@ -import { AbstractMesh, Mesh, MeshBuilder, ParticleHelper, ThinEngine, Tools, Vector3 } from "@babylonjs/core"; +import { AbstractMesh, Vector3 } from "@babylonjs/core"; import { PointerEventTypes, PointerInfo } from "@babylonjs/core/Events/pointerEvents"; import { EventState, Observer } from "@babylonjs/core/Misc/observable"; import { classToClass } from "class-transformer"; @@ -24,10 +24,12 @@ import { MarkNodeInfo } from "../../model/info/mark/mark-plan-info"; import { ModelInfo_mark } from "../../model/info/mark/model-info-mark"; import { ModelInfo_building } from "../../model/info/model/model-info-building"; import { ModelInfo_facility } from "../../model/info/model/model-info-facility"; +import { BabylonTool } from "../../tool/babylon-tool"; import { LoadTool } from "../../tool/load-tool"; import { MeshPool, MeshPoolInfo } from "../../tool/mesh-pool"; import { ParticleSystemTool } from "../../tool/particle-system-tool"; import { BuildingUIItem } from "../building-window/building-ui-item"; +import { BuildingWindow } from "../building-window/building-window"; import { IndoorFloorUIItem } from "../indoor-window/indoor-floorui-item"; import { UIBase } from "../window-base/ui-base"; import { WeatherTool } from "./weather-tool"; @@ -322,10 +324,15 @@ export class MarkWindow extends UIBase { nodeCopy = classToClass(this.currentMarkNodeInfo.nodeData); } } + this.clearNodeInfo(); + let markPlanData: MarkPlanData = null; + if (DataManager.allMarkPlanData == null) { + return; + } //更新新节点 - let markPlanData = DataManager.allMarkPlanData.getMarkPlanById(planId); - this.clearNodeInfo(); + markPlanData = DataManager.allMarkPlanData.getMarkPlanById(planId); + if (markPlanData != null) { //表示不是取消选中 if (nodeCopy == null) { nodeCopy = classToClass(markPlanData.getNodeById(nodeId)); @@ -1020,7 +1027,8 @@ export class MarkWindow extends UIBase { } markNodeData.cameraData.getDataFromCamera(SceneManager.Instance.defaultCamera); - console.log("保存", markNodeData); + markNodeData.showZP = BuildingWindow.instance.currentZPShow; + console.log("记录节点", markNodeData); } /** @@ -1145,6 +1153,7 @@ export class MarkWindow extends UIBase { updateNodeInfo() { let environmentData = this.currentMarkNodeInfo.nodeData.getCurrentEnvironmentData(); let cameraData = this.currentMarkNodeInfo.nodeData.cameraData; + let showZP = this.currentMarkNodeInfo.nodeData.showZP; let instance = this; if (environmentData.isOutdoor) //要在室外 { @@ -1164,7 +1173,15 @@ export class MarkWindow extends UIBase { StatusManager.s_currentStatus.indoorWindow.onBtnToOutDoor(false); } else if (StatusManager.s_currentStatus instanceof BuildingStatus) { - this.currentMarkNodeInfo.nodeData.cameraData.setDataToCamera(SceneManager.Instance.defaultCamera); + //this.currentMarkNodeInfo.nodeData.cameraData.setDataToCamera(SceneManager.Instance.defaultCamera); + // let camera = SceneManager.Instance.defaultCamera; + // if (cameraData != null) { + // BabylonTool.AnimMoveCameraTargetAB(camera, 60, cameraData.target, cameraData.radius, cameraData.alpha, cameraData.beta); + // } + + //仅此分支生效 + BuildingWindow.instance.revoverCamera(cameraData, showZP); + instance.clearEnterObserver(true); for (let i = 0; i < StatusManager.s_currentStatus.buildingWindow.buildingUIItems.length; i++) {