import { TransformNode } from '@babylonjs/core'; import { BuildingStatus } from 'src/app/babylon/controller/status/building-status'; import { IndoorStatus } from 'src/app/babylon/controller/status/indoor-status'; import { StatusManager } from 'src/app/babylon/controller/status/status-manager'; import { TsTool } from 'src/app/babylon/tool/ts-tool'; import { BuildingInfo } from './building-info'; //环境数据 export class BuildingInfo_Environment extends BuildingInfo { readonly c_FuGaiCeng = "FuGaiCeng";//覆盖层关键字 go_FuGaiCeng: TransformNode; /** * 更新覆盖层。 室外模式显示覆盖层,室内模式隐藏 */ updateFuGaiCeng() { if (this.go_FuGaiCeng == null) { return; } let currentStatus = StatusManager.s_currentStatus; if (currentStatus instanceof IndoorStatus) { this.go_FuGaiCeng.setEnabled(true); } else if (currentStatus instanceof BuildingStatus) { this.go_FuGaiCeng.setEnabled(false); } } /** * 设置modelInfo时 */ onSetModel() { super.onSetModel(); if (this.ModelInfo != null && this.ModelInfo.modelBox != null) { console.log("查找覆盖层", this.ModelInfo.modelBox); let allChildren = this.ModelInfo.modelBox.getChildTransformNodes(false); if (allChildren != null) { for (let i = 0; i < allChildren.length; i++) { if (TsTool.stringContain(allChildren[i].name, this.c_FuGaiCeng)) { this.go_FuGaiCeng = allChildren[i]; break; } } } } } }