|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
|
|
|
|
|
import { AbstractMesh, Material, Mesh } from "@babylonjs/core"; |
|
|
|
|
import { PlanComponent } from "src/app/pages/plan/plan.component"; |
|
|
|
|
import { DataManager } from "../../controller/data-manager"; |
|
|
|
|
import { InfoManager } from "../../controller/info-manager"; |
|
|
|
@ -23,6 +24,11 @@ import { BuildingUIItem } from "./building-ui-item";
|
|
|
|
|
//建筑界面
|
|
|
|
|
export class BuildingWindow extends UIBase { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* uv动画材质的特殊命名 |
|
|
|
|
*/ |
|
|
|
|
readonly c_MAT_UV = "MAT_UV"; |
|
|
|
|
|
|
|
|
|
static instance: BuildingWindow; |
|
|
|
|
|
|
|
|
|
buldingStatus: BuildingStatus; |
|
|
|
@ -370,6 +376,9 @@ export class BuildingWindow extends UIBase {
|
|
|
|
|
if (updateFacility) { |
|
|
|
|
|
|
|
|
|
InfoManager.createFacilityInfos(buildingInfo.buildingData.outdoorData, buildingInfo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (buildingInfo instanceof BuildingInfo_Environment) { |
|
|
|
|
buildingInfo.updateFuGaiCeng(); |
|
|
|
@ -581,11 +590,14 @@ export class BuildingWindow extends UIBase {
|
|
|
|
|
for (let i = 0; i < allNode.length; i++) { |
|
|
|
|
let nodeName = allNode[i].name; |
|
|
|
|
|
|
|
|
|
if (TsTool.stringContain(nodeName, this.c_xiaoFang)) //消防
|
|
|
|
|
if (TsTool.stringContain(nodeName, "primitive")) { |
|
|
|
|
//复合材质被分解为多个子mesh,不看做特殊意义的对象
|
|
|
|
|
} |
|
|
|
|
else if (TsTool.stringContain(nodeName, this.c_xiaoFang)) //消防
|
|
|
|
|
{ |
|
|
|
|
this.currentBuidngItem.createFacilityByMesh(allNode[i]); |
|
|
|
|
} |
|
|
|
|
else if (TsTool.stringContain(nodeName, this.c_xiaoFang))//加油站
|
|
|
|
|
else if (TsTool.stringContain(nodeName, this.c_jiaYou))//加油站
|
|
|
|
|
{ |
|
|
|
|
this.currentBuidngItem.createOilingByMesh(allNode[i]); |
|
|
|
|
} |
|
|
|
@ -621,6 +633,11 @@ export class BuildingWindow extends UIBase {
|
|
|
|
|
*/ |
|
|
|
|
zdByMoudle: Map<JYZInfoMoudleType, FacilityInfoByType[]> = new Map(); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* uv动画所需材质 |
|
|
|
|
*/ |
|
|
|
|
mat_UV: Map<JYZInfoMoudleType, Material[]> = new Map(); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 展示加油站信息模块 |
|
|
|
|
* @param type
|
|
|
|
@ -652,10 +669,12 @@ export class BuildingWindow extends UIBase {
|
|
|
|
|
if (this.zdByMoudle.has(type)) { |
|
|
|
|
zdByType = this.zdByMoudle.get(type); |
|
|
|
|
} |
|
|
|
|
console.log("阻挡物", zdByType); |
|
|
|
|
for (let i = 0; i < zdByType.length; i++) { |
|
|
|
|
let infos = zdByType[i].facilityInfo; |
|
|
|
|
if (infos != null) { |
|
|
|
|
for (let j = 0; j < infos.length; j++) { |
|
|
|
|
console.log("隐藏阻挡物", infos[j]); |
|
|
|
|
infos[j].setEnable(!show); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -694,24 +713,18 @@ export class BuildingWindow extends UIBase {
|
|
|
|
|
return; //没有设备
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < allFacilityByType.length; i++) { |
|
|
|
|
let l_facilityByType = allFacilityByType[i]; |
|
|
|
|
if (TsTool.stringContain(l_facilityByType.type, zdKey)) { |
|
|
|
|
if (!this.zdByMoudle.has(moudleType)) { |
|
|
|
|
this.zdByMoudle.set(moudleType, []); |
|
|
|
|
} |
|
|
|
|
this.zdByMoudle.get(moudleType).push(l_facilityByType); |
|
|
|
|
} |
|
|
|
|
else if (TsTool.stringContain(l_facilityByType.type, moudleTypeKey)) { |
|
|
|
|
this.facilitysByMoudle.get(moudleType).push(l_facilityByType); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// for (var l_facility in FacilityType) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -731,7 +744,78 @@ export class BuildingWindow extends UIBase {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取设备所需UV材质(如果有的话) |
|
|
|
|
* @param facilityType
|
|
|
|
|
* @param mesh
|
|
|
|
|
*/ |
|
|
|
|
getUVMat(facilityType: FacilityType, mesh: AbstractMesh) { |
|
|
|
|
let moudleType: JYZInfoMoudleType = null; |
|
|
|
|
switch (facilityType) { |
|
|
|
|
case FacilityType.XF_TSLX: |
|
|
|
|
moudleType = JYZInfoMoudleType.TSLX; |
|
|
|
|
break; |
|
|
|
|
case FacilityType.JY_SYGX: |
|
|
|
|
moudleType = JYZInfoMoudleType.SYG; |
|
|
|
|
break; |
|
|
|
|
case FacilityType.JY_YQHSGX: |
|
|
|
|
moudleType = JYZInfoMoudleType.YQHSGX; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (moudleType != null) { |
|
|
|
|
if (!this.mat_UV.has(moudleType)) { |
|
|
|
|
this.mat_UV.set(moudleType, []); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let mats = this.findUVMat(mesh); //找到mesh上的uv材质
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < mats.length; i++) { |
|
|
|
|
let l_mat = mats[i]; |
|
|
|
|
|
|
|
|
|
let mat_uvByType = this.mat_UV.get(moudleType); |
|
|
|
|
let isRepeat = false;//是重复的
|
|
|
|
|
for (let j = 0; j < mat_uvByType.length; j++) { |
|
|
|
|
if (isRepeat) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (l_mat == mat_uvByType[j]) { |
|
|
|
|
isRepeat = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isRepeat)//不重复,就添加进去
|
|
|
|
|
{ |
|
|
|
|
this.mat_UV.get(moudleType).push(l_mat); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查找mesh中uv动画所需的材质 |
|
|
|
|
* @param mesh
|
|
|
|
|
*/ |
|
|
|
|
private findUVMat(mesh: AbstractMesh) { |
|
|
|
|
let result = []; |
|
|
|
|
|
|
|
|
|
let childMesh = mesh.getChildMeshes(); |
|
|
|
|
childMesh.push(mesh); |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < childMesh.length; i++) { |
|
|
|
|
let mat = childMesh[i].material; |
|
|
|
|
if (TsTool.stringContain(mat.name, this.c_MAT_UV)) { |
|
|
|
|
// for(let j =0;j< result.length;j++)
|
|
|
|
|
// {
|
|
|
|
|
// if(mat != result[j])
|
|
|
|
|
// {
|
|
|
|
|
result.push(mat); |
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|