陈鹏飞 3 years ago
parent
commit
f0ba93e60b
  1. 19
      src/app/babylon/model/info/model/model-info.ts
  2. 165
      src/app/babylon/view/building-window/building-window.ts

19
src/app/babylon/model/info/model/model-info.ts

@ -1,16 +1,15 @@
import {
AbstractMesh,
AnimationGroup,
Color3,
EventState,
GizmoManager,
Mesh,
PointerDragBehavior,
TransformNode,
Node,
Vector3,
} from '@babylonjs/core';
import { Button, Rectangle, Vector2WithInfo } from '@babylonjs/gui';
import { classToClass } from 'class-transformer';
import { SceneManager } from 'src/app/babylon/controller/scene-manager';
import { UIManager } from 'src/app/babylon/controller/ui-manager';
import { BabylonTool } from 'src/app/babylon/tool/babylon-tool';
import { GizmoTool } from 'src/app/babylon/tool/gizmo-tool';
@ -137,6 +136,20 @@ export class ModelInfo {
}
}
/**
* ()
* @param play false表示停止
*/
playShowAnim(play: boolean) {
if (this.modelBox != null) {
if (play) {
SceneManager.Instance.addToHighLight(this.modelBox as Mesh, Color3.Green());
}
else {
SceneManager.Instance.removeFromHighLight(this.modelBox as Mesh);
}
}
}
/**
*

165
src/app/babylon/view/building-window/building-window.ts

@ -6,8 +6,8 @@ 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 { BuildingData_Normal, BuildingData_Environment, BuildingData_ChemicalPlant, BuildingType, BuildingData } from "../../model/data/institution/building/building-data";
import { BuildingPosType, ModelType } from "../../model/data/model-data/model-data";
import { BuildingData, BuildingData_ChemicalPlant, BuildingData_Environment, BuildingData_Normal, BuildingType } from "../../model/data/institution/building/building-data";
import { ModelType } from "../../model/data/model-data/model-data";
import { FacilityType } from "../../model/data/model-data/model-data-facility";
import { ModelEditData } from "../../model/data/model-data/model-edit-data";
import { BuildingInfo } from "../../model/info/building/building-info";
@ -15,6 +15,7 @@ import { BuildingInfo_ChemicalPlant } from "../../model/info/building/building-i
import { BuildingInfo_Environment } from "../../model/info/building/building-info-environment";
import { BuildingInfo_Normal } from "../../model/info/building/building-info-normal";
import { ModelInfo_building } from "../../model/info/model/model-info-building";
import { FacilityInfoByType } from "../../model/info/model/model-info-facility";
import { TsTool } from "../../tool/ts-tool";
import { UIBase } from "../window-base/ui-base";
import { BuildingUIItem } from "./building-ui-item";
@ -201,6 +202,29 @@ export class BuildingWindow extends UIBase {
}
/**
*
* @param type
* @param show true表示显示
*/
showJYZInfoModel(type: JYZInfoMoudleType, show: boolean) {
if (this.currentJYZInfoMoudleType == type) {
if (show) {
return; //与上次显示的模块相同
}
else {
this.showJYZModules(type, show);
}
}
else {
this.showJYZModules(this.currentJYZInfoMoudleType, false); //先恢复之前隐藏的内容
this.showJYZModules(type, show);//展示本次要展示的内容
}
}
//#endregion
@ -571,4 +595,141 @@ export class BuildingWindow extends UIBase {
//#endregion
//#region 加油站基本信息模块的显隐表现
/**
*
*/
currentJYZInfoMoudleType: JYZInfoMoudleType = null;
/**
*
*/
facilitysByMoudle: Map<JYZInfoMoudleType, FacilityInfoByType[]> = new Map();
/**
*
*/
zdByMoudle: Map<JYZInfoMoudleType, FacilityInfoByType[]> = new Map();
/**
*
* @param type
* @param show
*/
showJYZModules(type: JYZInfoMoudleType, show: boolean) {
if (this.currentBuidngItem == null) {
return;
}
this.initFacilityTypeByMoudleType(type, this.currentBuidngItem.buildingInfo);
//设备: 显示UI
let facilityByType: FacilityInfoByType[] = [];
if (this.facilitysByMoudle.has(type)) {
facilityByType = this.facilitysByMoudle.get(type);
}
for (let i = 0; i < facilityByType.length; i++) {
let infos = facilityByType[i].facilityInfo;
if (infos != null) {
for (let j = 0; j < infos.length; j++) {
infos[j].playShowAnim(show);
}
}
}
//阻挡类物体
let zdByType: FacilityInfoByType[] = [];
if (this.zdByMoudle.has(type)) {
zdByType = this.zdByMoudle.get(type);
}
for (let i = 0; i < zdByType.length; i++) {
let infos = zdByType[i].facilityInfo;
if (infos != null) {
for (let j = 0; j < infos.length; j++) {
infos[j].setEnable(!show);
}
}
}
}
/**
*
* @param moudleType
*/
initFacilityTypeByMoudleType(moudleType: JYZInfoMoudleType, buildingInfo: BuildingInfo) {
let moudleTypeKey = moudleType + "_"; //当前模块物体的特殊字段
let zdKey = "ZD_" + moudleType; //阻挡类物体特殊字段
if (this.facilitysByMoudle.has(moudleType)) {
//已经初始化过了
return;
}
else {
this.facilitysByMoudle.set(moudleType, []);
}
let allFacilityByType = buildingInfo.ModelInfo.facilityInfos;
if (allFacilityByType == null) {
return; //没有设备
}
for (let i = 0; i < allFacilityByType.length; i++) {
let l_facilityByType = allFacilityByType[i];
if (TsTool.stringContain(l_facilityByType.type, zdKey)) {
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) {
// }
}
//#endregion
}
/**
*
*/
export enum JYZInfoMoudleType {
/**
*
*/
XF = "XF",
/**
*
*/
JYJ = "JYJ",
/**
*
*/
YG = "YG",
/**
*
*/
SYG = "SYG",
/**
* 线
*/
YQHSGX = "YQHSGX",
/**
* 线
*/
TSLX = "TSLX",
}
Loading…
Cancel
Save