From d09f6f5479c1ae79dfe0803d14c295e1e6b0a4a6 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Thu, 24 Feb 2022 10:48:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=98=80=E9=97=A8=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=20=E4=BF=AE=E5=A4=8Dbuildingwindow=E7=9A=84=E9=87=8A?= =?UTF-8?q?=E6=94=BEupdate=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++++++++++ .../model/info/model/model-info-building.ts | 6 ++++++ .../model/info/model/model-info-facility.ts | 3 ++- .../view/building-window/building-window.ts | 11 ++++++++-- .../facilityinfoinscene-window.ts | 10 ++++----- 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a8b3f4d..a25ea96 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,26 @@ # 中国石化加油站项目 +## 🌼v1.1.1 + +### 🌻 简介 + +> 时间:2022、2、24 周四 +> 添加阀门模块 + +### 🌻 详情 + +> 前端部分 + +- [🚩 重大变更] +- [🌱 新增] +- [🍀 完善] + +> 三维部分 + +- [🚩 重大变更] +- [🌱 新增] 新增阀门模块 +- [🍀 完善] + ## 🌼v1.1.0 ### 🌻 简介 diff --git a/src/app/babylon/model/info/model/model-info-building.ts b/src/app/babylon/model/info/model/model-info-building.ts index 42f7327..47bfd17 100644 --- a/src/app/babylon/model/info/model/model-info-building.ts +++ b/src/app/babylon/model/info/model/model-info-building.ts @@ -167,6 +167,12 @@ export class ModelInfo_building extends ModelInfo { dispose(disposeMesh?: boolean) { + if (this.updateObserver != null) { + SceneManager.Instance.scene.onAfterRenderObservable.remove(this.updateObserver); + this.updateObserver = null; + + } + this.disposeAllFacility(); super.dispose(disposeMesh); } diff --git a/src/app/babylon/model/info/model/model-info-facility.ts b/src/app/babylon/model/info/model/model-info-facility.ts index 918d60b..6084ee3 100644 --- a/src/app/babylon/model/info/model/model-info-facility.ts +++ b/src/app/babylon/model/info/model/model-info-facility.ts @@ -222,7 +222,8 @@ export class ModelInfo_facility extends ModelInfo { this.showFollowUI(play); if (this.modelBox != null) { let facilityType = (this.modelData as ModelData_facility).facilityType; - if (play && TsTool.stringContain(facilityType, "XF_")) { + //消防 或 阀门 持续高亮 + if (play && (TsTool.stringContain(facilityType, "XF_") || facilityType == FacilityType.JY_FM)) { SceneManager.Instance.addToHighLight(this.modelBox as Mesh, ModelInfo_facility.c_hightLightColor); } else { diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index 3c3d32c..a4d6dbf 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -1,5 +1,5 @@ -import { AbstractMesh, Material, PBRMaterial, Texture, Animatable } from "@babylonjs/core"; +import { AbstractMesh, Material, PBRMaterial, Texture, Animatable, Observable, Scene, Observer } from "@babylonjs/core"; import { PlanComponent } from "src/app/pages/plan/plan.component"; import { ConfigManager } from "../../controller/config-manager"; import { DataManager } from "../../controller/data-manager"; @@ -50,6 +50,8 @@ export class BuildingWindow extends UIBase { three: PlanComponent;//前端组件 + onUpdateObserver: Observer; + cameraAnim: Animatable;//相机动画 @@ -303,6 +305,7 @@ export class BuildingWindow extends UIBase { //#region 生命周期 onInit() { + console.log("初始化building") super.onInit(); GizmoTool.changeGizmoOpen(ModeManager.s_isMakeMode); //内部模式才默认打开gizmo @@ -315,7 +318,7 @@ export class BuildingWindow extends UIBase { this.three.buildingUIItems = this.buildingUIItems this.buildingUIItems.length ? this.three.beforeOneBuildingID = this.three.buildingUIItems[0].getBuildingID() : null let instance = this; - SceneManager.Instance.scene.onBeforeRenderObservable.add(() => { + this.onUpdateObserver = SceneManager.Instance.scene.onBeforeRenderObservable.add(() => { instance.onUpdate(); }) EventManager.addListener(Event_LoadingChange, (eventInfo) => { @@ -369,6 +372,10 @@ export class BuildingWindow extends UIBase { for (let i = 0; i < this.buildingUIItems.length; i++) { this.buildingUIItems[i].dispose(); } + if (this.onUpdateObserver != null) { + SceneManager.Instance.scene.onBeforeRenderObservable.remove(this.onUpdateObserver); + this.onUpdateObserver = null; + } BuildingWindow.instance = null; } diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts index a222e04..70aa00f 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts @@ -507,7 +507,7 @@ export class FacilityInfoInSceneWindow extends UIBase { || (currentMoudle == null || currentMoudle == JYZInfoMoudleType.YG) && facilityInfosByType[i].type == FacilityType.JY_YG || (currentMoudle == null || currentMoudle == JYZInfoMoudleType.SYG) && facilityInfosByType[i].type == FacilityType.JY_SYGX || (currentMoudle == null || currentMoudle == JYZInfoMoudleType.YQHSGX) && facilityInfosByType[i].type == FacilityType.JY_YQHSGX - || (currentMoudle == null || currentMoudle == JYZInfoMoudleType.FM) && facilityInfosByType[i].type == FacilityType.JY_FM + // || (currentMoudle == null || currentMoudle == JYZInfoMoudleType.FM) && facilityInfosByType[i].type == FacilityType.JY_FM ) { allJYJInfo = allJYJInfo.concat(facilityInfosByType[i].facilityInfo); } @@ -553,10 +553,10 @@ export class FacilityInfoInSceneWindow extends UIBase { if (facilityData.facilityType != FacilityType.JY_JYJ && facilityData.facilityType != FacilityType.JY_YG && facilityData.facilityType != FacilityType.JY_SYGX && - facilityData.facilityType != FacilityType.JY_YQHSGX && - facilityData.facilityType != FacilityType.JY_FM + facilityData.facilityType != FacilityType.JY_YQHSGX + // facilityData.facilityType != FacilityType.JY_FM ) { - //只有加油机和油罐和输油管、油气回收、阀门有高亮显示和取消 + //只有加油机和油罐和输油管、油气回收有高亮显示和取消 return; } //} @@ -569,7 +569,7 @@ export class FacilityInfoInSceneWindow extends UIBase { || BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.YG || BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.SYG || BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.YQHSGX - || BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.FM + // || BuildingWindow.instance.currentJYZInfoMoudleType == JYZInfoMoudleType.FM ) { SceneManager.Instance.removeFromHighLight(facilityInfo.modelBox as Mesh); }