|
|
@ -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 { PlanComponent } from "src/app/pages/plan/plan.component"; |
|
|
|
import { ConfigManager } from "../../controller/config-manager"; |
|
|
|
import { ConfigManager } from "../../controller/config-manager"; |
|
|
|
import { DataManager } from "../../controller/data-manager"; |
|
|
|
import { DataManager } from "../../controller/data-manager"; |
|
|
@ -50,6 +50,8 @@ export class BuildingWindow extends UIBase { |
|
|
|
|
|
|
|
|
|
|
|
three: PlanComponent;//前端组件
|
|
|
|
three: PlanComponent;//前端组件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onUpdateObserver: Observer<Scene>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cameraAnim: Animatable;//相机动画
|
|
|
|
cameraAnim: Animatable;//相机动画
|
|
|
|
|
|
|
|
|
|
|
@ -303,6 +305,7 @@ export class BuildingWindow extends UIBase { |
|
|
|
|
|
|
|
|
|
|
|
//#region 生命周期
|
|
|
|
//#region 生命周期
|
|
|
|
onInit() { |
|
|
|
onInit() { |
|
|
|
|
|
|
|
console.log("初始化building") |
|
|
|
super.onInit(); |
|
|
|
super.onInit(); |
|
|
|
GizmoTool.changeGizmoOpen(ModeManager.s_isMakeMode); //内部模式才默认打开gizmo
|
|
|
|
GizmoTool.changeGizmoOpen(ModeManager.s_isMakeMode); //内部模式才默认打开gizmo
|
|
|
|
|
|
|
|
|
|
|
@ -315,7 +318,7 @@ export class BuildingWindow extends UIBase { |
|
|
|
this.three.buildingUIItems = this.buildingUIItems |
|
|
|
this.three.buildingUIItems = this.buildingUIItems |
|
|
|
this.buildingUIItems.length ? this.three.beforeOneBuildingID = this.three.buildingUIItems[0].getBuildingID() : null |
|
|
|
this.buildingUIItems.length ? this.three.beforeOneBuildingID = this.three.buildingUIItems[0].getBuildingID() : null |
|
|
|
let instance = this; |
|
|
|
let instance = this; |
|
|
|
SceneManager.Instance.scene.onBeforeRenderObservable.add(() => { |
|
|
|
this.onUpdateObserver = SceneManager.Instance.scene.onBeforeRenderObservable.add(() => { |
|
|
|
instance.onUpdate(); |
|
|
|
instance.onUpdate(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
EventManager.addListener<Event_LoadingChange>(Event_LoadingChange, (eventInfo) => { |
|
|
|
EventManager.addListener<Event_LoadingChange>(Event_LoadingChange, (eventInfo) => { |
|
|
@ -369,6 +372,10 @@ export class BuildingWindow extends UIBase { |
|
|
|
for (let i = 0; i < this.buildingUIItems.length; i++) { |
|
|
|
for (let i = 0; i < this.buildingUIItems.length; i++) { |
|
|
|
this.buildingUIItems[i].dispose(); |
|
|
|
this.buildingUIItems[i].dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.onUpdateObserver != null) { |
|
|
|
|
|
|
|
SceneManager.Instance.scene.onBeforeRenderObservable.remove(this.onUpdateObserver); |
|
|
|
|
|
|
|
this.onUpdateObserver = null; |
|
|
|
|
|
|
|
} |
|
|
|
BuildingWindow.instance = null; |
|
|
|
BuildingWindow.instance = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|