From 45b7adc6d54dfe7d58d97d315c446778b8e2dc94 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Thu, 18 Nov 2021 10:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/babylon/controller/mode-manager.ts | 2 +- src/app/babylon/controller/scene-manager.ts | 11 ++++++----- src/app/babylon/controller/serve-manager.ts | 2 +- src/app/babylon/tool/gizmo-tool.ts | 1 - src/app/babylon/tool/load-tool.ts | 9 +++++---- .../babylon/view/building-window/building-window.ts | 7 ++++--- src/app/pages/plan/plan.component.ts | 13 ++++++++++--- .../service/babylon/building-basic-infos.service.ts | 13 +++++-------- 8 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/app/babylon/controller/mode-manager.ts b/src/app/babylon/controller/mode-manager.ts index 330f13a..27cb259 100644 --- a/src/app/babylon/controller/mode-manager.ts +++ b/src/app/babylon/controller/mode-manager.ts @@ -18,7 +18,7 @@ export class ModeManager { * 当前模式的类型 * 外部使用 currentMode 属性访问和修改 */ - private static s_currentMode: ModeType = ModeType.Look; + private static s_currentMode: ModeType = ModeType.Edit; /** * 制作模式代表内部编辑人员,可新增单位、上传模型,查看模式代表交付的模式 diff --git a/src/app/babylon/controller/scene-manager.ts b/src/app/babylon/controller/scene-manager.ts index 9586ce5..9a3fc03 100644 --- a/src/app/babylon/controller/scene-manager.ts +++ b/src/app/babylon/controller/scene-manager.ts @@ -58,6 +58,7 @@ import { MarkData_multiArrow_CT, MarkData_multiArrow_JG } from '../model/data/ma import { ModelInfo_mark_multiArrow } from '../model/info/mark/other/mark-plan-multi-arrow'; import { ModelInfo_mark_particle } from '../model/info/mark/other/mark-plan-particle-info'; import { FacilityPosType, ModelData_facility } from '../model/data/model-data/model-data-facility'; +import { LoadTool } from '../tool/load-tool'; //场景管理器 export class SceneManager { @@ -556,7 +557,7 @@ export class SceneManager { } SceneManager.endLoadMesh(modelData.resPath, modelData.resName); let box = SceneManager.importMeshSuccess(newMeshes, particleSystems, skeletons, animationGroups, modelInfo, needBox, modelData); - console.log("加载模型完成", modelData.resName); + //console.log("加载模型完成", modelData.resName); onSuccess(newMeshes, box, modelInfo); }, null, function (scene: Scene, message: string, exception?: any) { @@ -568,14 +569,14 @@ export class SceneManager { SceneManager.createModel(modelType, modelData, needBox, isNew, tag, onSuccess, onError, l_index); - console.log("重新开始加载" + l_index, modelData); + //console.log("重新开始加载" + l_index, modelData); console.log(exception); } else { modelInfo.dispose(); - console.log(message); - console.log(exception); - // alert("模型加载失败: " + message + "==" + exception); + LoadTool.remove(modelData.resPath + modelData.resName); + console.log(message, exception); + alert("模型加载失败,请刷新页面重试: " + message + "==" + exception); // alert(exception); if (onError) { onError(message) diff --git a/src/app/babylon/controller/serve-manager.ts b/src/app/babylon/controller/serve-manager.ts index 90cd9ea..b0e2e72 100644 --- a/src/app/babylon/controller/serve-manager.ts +++ b/src/app/babylon/controller/serve-manager.ts @@ -53,7 +53,7 @@ export class ServeManager { let l_data = classToPlain(institutionData); console.log("保存单位", l_data); - this.buildingBISrv.postBuildingBasicInfos(key, l_data) + this.buildingBISrv.postBuildingBasicInfos(key, 1, l_data) .subscribe(data => { console.log("保存单位成功:" + key, l_data); if (onSuccess) { diff --git a/src/app/babylon/tool/gizmo-tool.ts b/src/app/babylon/tool/gizmo-tool.ts index 4032194..d407671 100644 --- a/src/app/babylon/tool/gizmo-tool.ts +++ b/src/app/babylon/tool/gizmo-tool.ts @@ -199,7 +199,6 @@ export class GizmoTool { //改变Gizmo目标 static changeGizmoAim(mesh: AbstractMesh, x: boolean = true, y = true, z = true) { - console.trace("改变gizmo"); GizmoTool.s_nowPickAim_mesh = mesh; GizmoTool.s_gizmoManager.attachToMesh(mesh); GizmoTool.s_gizmoManager.gizmos.positionGizmo.xGizmo.isEnabled = x; diff --git a/src/app/babylon/tool/load-tool.ts b/src/app/babylon/tool/load-tool.ts index d135607..a92efea 100644 --- a/src/app/babylon/tool/load-tool.ts +++ b/src/app/babylon/tool/load-tool.ts @@ -1,3 +1,4 @@ +import { PlanComponent } from "src/app/pages/plan/plan.component"; /** * 加载管理器 @@ -49,16 +50,16 @@ export class LoadTool { * 开始加载 */ static onStart() { - console.log("开始加载"); - //ThreeDimensionalHomeComponent.instance.maskLayerService.sendMessage(true) + // console.log("开始加载"); + PlanComponent.instance.showLoading(true); } /** * 全部加载结束 */ static onEnd() { - console.log("结束加载"); - //ThreeDimensionalHomeComponent.instance.maskLayerService.sendMessage(false) + // console.log("结束加载"); + PlanComponent.instance.showLoading(false); } } \ No newline at end of file diff --git a/src/app/babylon/view/building-window/building-window.ts b/src/app/babylon/view/building-window/building-window.ts index 5137ad9..94c793e 100644 --- a/src/app/babylon/view/building-window/building-window.ts +++ b/src/app/babylon/view/building-window/building-window.ts @@ -128,7 +128,7 @@ export class BuildingWindow extends UIBase { file.push(manifestFile); //临时关闭缓存文件 } - + PlanComponent.instance.showLoading(true); ServeManager.instance.uploadFile(0, file, resPath_out, (name: string, path: string, currentfile) => { if (TsTool.stringContain(name, ".gltf")) { if (TsTool.stringContain(name, ".gltf.manifest")) { @@ -150,6 +150,7 @@ export class BuildingWindow extends UIBase { } } , () => { + PlanComponent.instance.showLoading(false); let buildingInfo = buildingWindow.getBuildingInfo(buildingData.normalData.key); buildingWindow.updateBuildingModel(buildingInfo, true); // buildingWindow.three = ThreeDimensionalHomeComponent.instance; @@ -506,7 +507,7 @@ export class BuildingWindow extends UIBase { if (firstType == BuildingType.Environment) { instance.createOneBuildingItem(firstItem, 0, (uiItem, index) => { instance.onChangeCurrentBuildingItem(uiItem, false); - uiItem.lookAt(false); + // uiItem.lookAt(false); if (buildingDatas_Environment.length > 1) { instance.addBuildings(BuildingType.Environment, 1); } @@ -519,7 +520,7 @@ export class BuildingWindow extends UIBase { else { instance.createOneBuildingItem(firstItem, 0, (uiItem, index) => { instance.onChangeCurrentBuildingItem(uiItem, false); - uiItem.lookAt(false); + // uiItem.lookAt(false); if (buildingDatas_mormal.length > 1) { instance.addBuildings(BuildingType.Normal, 1); } diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 5938a85..b92379f 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -38,7 +38,7 @@ export class PlanComponent implements OnInit { public game: Game = new Game(); public beforeOneSatus; //当前 satus public canvas: HTMLCanvasElement; //canvas 实例 - public isShowLoading: boolean = false; //显隐 loading加载条 + public isShowLoading: boolean = true; //显隐 loading加载条 ngOnInit(): void { PlanComponent.instance = this; @@ -365,14 +365,21 @@ export class PlanComponent implements OnInit { this.message.info(title); } + /** + * 展示加载遮罩 + * @param show + */ + showLoading(show: boolean) { + this.isShowLoading = show; + } } // 处置预案 所有图标 export class planIcons { - iconsName: string[] = ["灾情","内部力量","外部力量","其他"] - icons: MarkData[][] = [AllMarkData.CreateAllMarkData().marks_Disaster,AllMarkData.CreateAllMarkData().marks_Inside,AllMarkData.CreateAllMarkData().marks_Outside,AllMarkData.CreateAllMarkData().marks_Other,] + iconsName: string[] = ["灾情", "内部力量", "外部力量", "其他"] + icons: MarkData[][] = [AllMarkData.CreateAllMarkData().marks_Disaster, AllMarkData.CreateAllMarkData().marks_Inside, AllMarkData.CreateAllMarkData().marks_Outside, AllMarkData.CreateAllMarkData().marks_Other,] } //创建/编辑 建筑dataType export class modelBuilding { diff --git a/src/app/service/babylon/building-basic-infos.service.ts b/src/app/service/babylon/building-basic-infos.service.ts index 8245839..61f8e45 100644 --- a/src/app/service/babylon/building-basic-infos.service.ts +++ b/src/app/service/babylon/building-basic-infos.service.ts @@ -35,8 +35,8 @@ export class BuildingBasicInfosService { * @param name * @param data */ - postBuildingBasicInfos(name: string, data: object): Observable { - return this.postInfos(this.api_buildingInfo, name, data); + postBuildingBasicInfos(name: string, gasstationId: number, data: object): Observable { + return this.postInfos(this.api_buildingInfo, data, { name: name, gasstationId: gasstationId }); } /** @@ -53,7 +53,7 @@ export class BuildingBasicInfosService { * @param data */ postMarkData(name: string, data: object): Observable { - return this.postInfos(this.api_sandBox, name, data); + return this.postInfos(this.api_sandBox, data, { name: name }); } @@ -92,14 +92,11 @@ export class BuildingBasicInfosService { * @param name * @param data */ - postInfos(api: string, name: string, data: object) { - let params = { - name: name, - }; + postInfos(api: string, body: object, params = {}) { let headers = this.headers; - return this.http.post(api + this.c_post, `'${JSON.stringify(data)}'`, { headers, params }) + return this.http.post(api + this.c_post, `'${JSON.stringify(body)}'`, { headers, params }) .pipe( catchError((err) => this.handleError(err)) );