From 0503c77265ecabd501af9ab2fe27860f77084dfd Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Fri, 12 Nov 2021 17:15:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E6=80=A5=E5=A4=84=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E6=BC=94=E5=87=BA=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/babylon/controller/serve-manager.ts | 13 ++- .../babylon/model/info/mark/mark-plan-info.ts | 2 +- .../babylon/view/mark-window/mark-window.ts | 97 +++++++++++++++++-- 3 files changed, 99 insertions(+), 13 deletions(-) diff --git a/src/app/babylon/controller/serve-manager.ts b/src/app/babylon/controller/serve-manager.ts index dc50523..0ac613a 100644 --- a/src/app/babylon/controller/serve-manager.ts +++ b/src/app/babylon/controller/serve-manager.ts @@ -5,7 +5,7 @@ import { BuildingBasicInfosService } from "src/app/service/babylon/building-basi import { ObjectsService } from "src/app/service/objects.service"; import { InsitutionDataSimple } from "../model/data/institution/institution-data-simple"; import { AllMarkPlanData } from "../model/data/mark/mark-plan-data"; -import { ModeManager } from "./mode-manager"; +import { ModeManager, ModeType } from "./mode-manager"; //服务器通信 export class ServeManager { @@ -95,7 +95,7 @@ export class ServeManager { this.buildingBISrv.getMarkData(institutionID) .subscribe(data => { - ModeManager.log(data); + // ModeManager.log(data); if (onSuccess) { onSuccess(institutionID, JSON.parse((data as any).result)); } @@ -103,7 +103,13 @@ export class ServeManager { if (error instanceof HttpErrorResponse) { if (error.status === 404) { ModeManager.log("没有标绘数据,新建:" + error.error); - onSuccess(institutionID, null); //data 为null ,表示新建 + if (ModeManager.currentMode == ModeType.Edit) { + onSuccess(institutionID, null); //data 为null ,表示新建 + } + else { + PlanComponent.instance.openSnackBar("暂无数据"); + } + } else { if (onError) { @@ -138,6 +144,7 @@ export class ServeManager { } //PlanComponent.instance.openSnackBar("保存标绘信息成功"); // alert("保存标绘信息成功"); + PlanComponent.instance.openSnackBar("保存成功"); //暂时没有失败的回调 onError }) diff --git a/src/app/babylon/model/info/mark/mark-plan-info.ts b/src/app/babylon/model/info/mark/mark-plan-info.ts index 7ef67bf..16e0a6d 100644 --- a/src/app/babylon/model/info/mark/mark-plan-info.ts +++ b/src/app/babylon/model/info/mark/mark-plan-info.ts @@ -83,7 +83,7 @@ export class MarkNodeInfo { } /** - * 获取下一个标绘物的id + * 获取下一个新建标绘物的id(用于新建) */ getNextMarkDataId() { //console.log(this.currentMarkDataIndex, 1); diff --git a/src/app/babylon/view/mark-window/mark-window.ts b/src/app/babylon/view/mark-window/mark-window.ts index 7e7f6ad..5fc0bcb 100644 --- a/src/app/babylon/view/mark-window/mark-window.ts +++ b/src/app/babylon/view/mark-window/mark-window.ts @@ -117,8 +117,8 @@ export class MarkWindow extends UIBase { isShowProperty3d: boolean = true; /** - * 是否显示水源 - */ + * 是否显示水源 + */ isShowWaterSource = false; //#region 生命周期 @@ -145,7 +145,9 @@ export class MarkWindow extends UIBase { this.weatherTool = new WeatherTool(SceneManager.Instance.defaultCamera, SceneManager.Instance.scene); - + SceneManager.Instance.scene.onBeforeRenderObservable.add(() => { + instance.onUpdateShow(); + }) } @@ -623,9 +625,9 @@ export class MarkWindow extends UIBase { } /** - * 改变风向 - * @param temperature - */ + * 改变风向 + * @param temperature + */ changeNature_windDirection(windDirection: WindDirectionType) { if (this.currentMarkNodeInfo == null) { return; @@ -635,9 +637,9 @@ export class MarkWindow extends UIBase { } /** -* 改变风速 -* @param temperature -*/ + * 改变风速 + * @param temperature + */ changeNature_windPower(windPower: number) { if (this.currentMarkNodeInfo == null) { return; @@ -646,7 +648,77 @@ export class MarkWindow extends UIBase { } + /** + * 播放或暂停演出系统 + * @param play false 表示暂停 + */ + playOrPauseShow(play: boolean) { + + + } + + /** + * 调至某一节点 + */ + skipToNode(nodeID: string) { + + } + + + + //#endregion + + + //#region 演出系统 + + + + /** + * 当前演出剩余时间 + */ + currentShowTime: number; + /** + * 当前节点的完整演出时间 + */ + totalShowTime: number; + + + /** + * 是否正在演出 + */ + isPlayingShow: boolean = false; + + + /** + * 播放 + * @param id + */ + playMarkNode(id: number) { + + + + //通知前端 + } + + /** + * 每帧更新 + */ + onUpdateShow() { + + if (this.isPlayingShow) { + if (this.currentShowTime > 0) { + this.currentShowTime -= SceneManager.Instance.scene.deltaTime * 0.001; + + if (this.currentShowTime <= 0) { + let l_currentMarkNodeData: MarkNodeData = this.currentMarkNodeInfo.nodeData; + //播放下一个节点 + this.getNextNode(l_currentMarkNodeData.id); + } + } + } + + } //#endregion @@ -904,6 +976,13 @@ export class MarkWindow extends UIBase { return result; } + /** + * 获取当前方案下,下一个节点,null表示没有了 + */ + getNextNode(id: number) { + let result: MarkNodeInfo = null; + return result; + } //#endregion