陈鹏飞 3 years ago
parent
commit
a1e52c5911
  1. 29
      src/app/babylon/controller/event-manager/events/event-loading-change.ts
  2. 11
      src/app/babylon/model/info/mark/mark-plan-info.ts
  3. 3
      src/app/babylon/tool/load-tool.ts
  4. 27
      src/app/babylon/tool/speaking-tool.ts
  5. 9
      src/app/babylon/view/mark-window/mark-window.ts

29
src/app/babylon/controller/event-manager/events/event-loading-change.ts

@ -0,0 +1,29 @@
import { Event_Base } from "../event-base";
import { EventManager } from "../event-manager";
/**
* loading遮罩
*/
export class Event_LoadingChange extends Event_Base {
/**
* loading中
*/
static isLoading: boolean = false;
/**
* loading条
*/
showLoading: boolean;
/**
*
* @param showLoading loading条
*/
static dispatch(showLoading: boolean) {
let eventData = new Event_LoadingChange();
eventData.showLoading = showLoading;
EventManager.dispatch<Event_LoadingChange>(Event_LoadingChange, eventData);
Event_LoadingChange.isLoading = showLoading;
}
}

11
src/app/babylon/model/info/mark/mark-plan-info.ts

@ -1,5 +1,6 @@
import { TsTool } from "src/app/babylon/tool/ts-tool"; import { TsTool } from "src/app/babylon/tool/ts-tool";
import { MarkWindow } from "src/app/babylon/view/mark-window/mark-window";
import { MarkTagPos, MarkType } from "../../data/mark/mark-data"; import { MarkTagPos, MarkType } from "../../data/mark/mark-data";
import { MarkNodeData, MarkPlanData } from "../../data/mark/mark-plan-data"; import { MarkNodeData, MarkPlanData } from "../../data/mark/mark-plan-data";
import { ModelInfo_mark } from "./model-info-mark"; import { ModelInfo_mark } from "./model-info-mark";
@ -99,6 +100,16 @@ export class MarkNodeInfo {
return this.currentMarkDataIndex; return this.currentMarkDataIndex;
} }
/**
*
*/
readDescribe() {
if (this.nodeData != null) {
MarkWindow.instance.readDescribe(this.nodeData.describe);
}
}
/** /**

3
src/app/babylon/tool/load-tool.ts

@ -1,4 +1,5 @@
import { PlanComponent } from "src/app/pages/plan/plan.component"; import { PlanComponent } from "src/app/pages/plan/plan.component";
import { Event_LoadingChange } from "../controller/event-manager/events/event-loading-change";
/** /**
* *
@ -52,6 +53,7 @@ export class LoadTool {
static onStart() { static onStart() {
// console.log("开始加载"); // console.log("开始加载");
PlanComponent.instance.showLoading(true); PlanComponent.instance.showLoading(true);
Event_LoadingChange.dispatch(true);
} }
/** /**
@ -60,6 +62,7 @@ export class LoadTool {
static onEnd() { static onEnd() {
// console.log("结束加载"); // console.log("结束加载");
PlanComponent.instance.showLoading(false); PlanComponent.instance.showLoading(false);
Event_LoadingChange.dispatch(false);
} }
} }

27
src/app/babylon/tool/speaking-tool.ts

@ -1,3 +1,5 @@
import { EventManager } from "../controller/event-manager/event-manager";
import { Event_LoadingChange } from "../controller/event-manager/events/event-loading-change";
/** /**
* *
@ -10,9 +12,25 @@ export class SpeakingTool {
if (SpeakingTool.instance == null) { if (SpeakingTool.instance == null) {
SpeakingTool.instance = new SpeakingTool(); SpeakingTool.instance = new SpeakingTool();
} }
EventManager.addListener<Event_LoadingChange>(Event_LoadingChange, (eventInfo) => {
SpeakingTool.instance.onChangeLoading(eventInfo);
});
return SpeakingTool.instance; return SpeakingTool.instance;
} }
/**
* loading状态改变时
* @param eventInfo
*/
onChangeLoading(eventInfo: Event_LoadingChange) {
if (eventInfo.showLoading) {
this.pause();
}
else {
this.resume();
}
}
/** /**
* *
@ -34,6 +52,10 @@ export class SpeakingTool {
speakMsg.pitch = 1.5; speakMsg.pitch = 1.5;
window.speechSynthesis.speak(speakMsg); window.speechSynthesis.speak(speakMsg);
if (Event_LoadingChange.isLoading) {
this.pause();
}
return speakMsg; return speakMsg;
} }
} }
@ -73,4 +95,7 @@ export class SpeakingTool {
return false; return false;
} }
} }

9
src/app/babylon/view/mark-window/mark-window.ts

@ -7,9 +7,9 @@ import { DataManager } from "../../controller/data-manager";
import { EventManager } from "../../controller/event-manager/event-manager"; import { EventManager } from "../../controller/event-manager/event-manager";
import { Event_GetAllMarkPlanData } from "../../controller/event-manager/events/event-get-markplandata-success"; import { Event_GetAllMarkPlanData } from "../../controller/event-manager/events/event-get-markplandata-success";
import { Event_KeyboardInput } from "../../controller/event-manager/events/event-keyboard-input"; import { Event_KeyboardInput } from "../../controller/event-manager/events/event-keyboard-input";
import { Event_LoadingChange } from "../../controller/event-manager/events/event-loading-change";
import { Event_MarkInfoChange, MarkInfoChangeType } from "../../controller/event-manager/events/event-mark-info-change"; import { Event_MarkInfoChange, MarkInfoChangeType } from "../../controller/event-manager/events/event-mark-info-change";
import { InputController } from "../../controller/inputController"; import { InputController } from "../../controller/inputController";
import { ModeManager } from "../../controller/mode-manager";
import { SceneManager } from "../../controller/scene-manager"; import { SceneManager } from "../../controller/scene-manager";
import { BuildingStatus } from "../../controller/status/building-status"; import { BuildingStatus } from "../../controller/status/building-status";
import { IndoorStatus } from "../../controller/status/indoor-status"; import { IndoorStatus } from "../../controller/status/indoor-status";
@ -237,7 +237,7 @@ export class MarkWindow extends UIBase {
* @param markPlanId idID * @param markPlanId idID
* @param nodeId idid * @param nodeId idid
*/ */
saveToOldNode(markPlanId: number, nodeId: number) { saveToOldNode(markPlanId: number, nodeId: number, newName?: string) {
let markPlaneData = DataManager.allMarkPlanData.getMarkPlanById(markPlanId); let markPlaneData = DataManager.allMarkPlanData.getMarkPlanById(markPlanId);
if (markPlaneData == null) { if (markPlaneData == null) {
console.error("没找到标绘方案:" + markPlanId) console.error("没找到标绘方案:" + markPlanId)
@ -248,6 +248,9 @@ export class MarkWindow extends UIBase {
let copyNodeData = classToClass(this.currentMarkNodeDataCopy);//覆盖数据 let copyNodeData = classToClass(this.currentMarkNodeDataCopy);//覆盖数据
copyNodeData.id = oldNodeData.id; copyNodeData.id = oldNodeData.id;
copyNodeData.index = oldNodeData.index; copyNodeData.index = oldNodeData.index;
if (newName != null) {
copyNodeData.name = newName;
}
// copyNodeData.name = oldNodeData.name; // copyNodeData.name = oldNodeData.name;
markPlaneData.setNodeData(nodeId, copyNodeData);//覆盖数据 markPlaneData.setNodeData(nodeId, copyNodeData);//覆盖数据
@ -261,7 +264,7 @@ export class MarkWindow extends UIBase {
*/ */
createNewNodeAndSave(markPlanId: number, name: string) { createNewNodeAndSave(markPlanId: number, name: string) {
let newNode = this.createMarkNodeData(markPlanId, name); let newNode = this.createMarkNodeData(markPlanId, name);
this.saveToOldNode(markPlanId, newNode.id); this.saveToOldNode(markPlanId, newNode.id, name);
} }

Loading…
Cancel
Save