Browse Source

提交语音工具

dev
刘向辉 3 years ago
parent
commit
b216930430
  1. 2
      src/app/babylon/model/info/model/model-info-facility.ts
  2. 64
      src/app/babylon/tool/speaking-tool.ts
  3. 5
      src/app/babylon/view/facility-window/facility-window.ts
  4. 6
      yarn.lock

2
src/app/babylon/model/info/model/model-info-facility.ts

@ -3,6 +3,7 @@ import { Button, Control, Ellipse, Rectangle, Vector2WithInfo } from "@babylonjs
import { ConfigManager } from "src/app/babylon/controller/config-manager";
import { SceneManager } from "src/app/babylon/controller/scene-manager";
import { BabylonUIStyleTool } from "src/app/babylon/tool/babylon-ui-style-tool";
import { SpeakingTool } from "src/app/babylon/tool/speaking-tool";
import { TsTool } from "src/app/babylon/tool/ts-tool";
import { FacilityWindow } from "src/app/babylon/view/facility-window/facility-window";
import { FacilityInfoInSceneWindow } from "src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window";
@ -124,6 +125,7 @@ export class ModelInfo_facility extends ModelInfo {
// this.onClickMeshIconBtn(eventData,eventState);
FacilityInfoInSceneWindow.instance.selectFacilityInfo(this);
// SpeakingTool.Instance.speak("这是离线版");
}
//展示属性

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

@ -0,0 +1,64 @@
/**
*
*/
export class SpeakingTool {
private static instance: SpeakingTool;
static get Instance() {
if (SpeakingTool.instance == null) {
SpeakingTool.instance = new SpeakingTool();
}
return SpeakingTool.instance;
}
/**
*
* @param msg
*/
speak(msg: string) {
if (this.isIE()) {
}
else {
let speakMsg = new SpeechSynthesisUtterance(msg);
speakMsg.lang = "zh-CN";
speakMsg.rate = 1;
speakMsg.pitch = 1.5;
window.speechSynthesis.speak(speakMsg);
return speakMsg;
}
}
/**
*
* @param speakMsg
*/
pause() {
window.speechSynthesis.pause();
}
/**
*
*/
resume() {
window.speechSynthesis.resume();
}
/**
* IE浏览器
*/
private isIE() {
// if ("ActiveXObject" in window) {
// console.log("IE 浏览器")
// return true;
// }
// else {
// return false;
// }
return false;
}
}

5
src/app/babylon/view/facility-window/facility-window.ts

@ -25,6 +25,7 @@ import { BuildingStatus } from '../../controller/status/building-status';
import { IndoorStatus } from '../../controller/status/indoor-status';
import { StatusManager } from '../../controller/status/status-manager';
import { UIManager } from '../../controller/ui-manager';
import { BuildingType } from '../../model/data/institution/building/building-data';
import { JYZInfoMoudleType } from '../../model/data/institution/jyz-show-data';
import { FacilityPosType, ModelData_facility, FacilityShowType, FacilityType } from '../../model/data/model-data/model-data-facility';
import { TransformData } from '../../model/data/transform-data';
@ -337,6 +338,10 @@ export class FacilityWindow extends UIBase {
// ThreeDimensionalHomeComponent.instance.openSnackBar("请先选中目标建筑");
return
}
else if (currentBuidngItem.getBuildingType() == BuildingType.Environment) {
alert("请选中主体建筑后,再进行标注")
return
}
Event_ChangeFacility.dispatch(facilityData, ModelChangeType.Add, null);

6
yarn.lock

@ -122,7 +122,7 @@
resolved "https://registry.npmmirror.com/@angular/animations/download/@angular/animations-9.1.13.tgz?cache=0&sync_timestamp=1634753072212&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2F%40angular%2Fanimations%2Fdownload%2F%40angular%2Fanimations-9.1.13.tgz#561305f7bf4a7a5ea3ff172d6fac31615667acb0"
integrity sha1-VhMF979Kel6j/xctb6wxYVZnrLA=
"@angular/cdk@^9.0.0":
"@angular/cdk@^9.0.0", "@angular/cdk@^9.2.4":
version "9.2.4"
resolved "https://registry.npmmirror.com/@angular/cdk/download/@angular/cdk-9.2.4.tgz#8413958bd275e4c34be3b96f56444671dd30ba93"
integrity sha1-hBOVi9J15MNL47lvVkRGcd0wupM=
@ -4976,9 +4976,9 @@ ecc-jsbn@~0.1.1:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
echarts@^4.6.0:
echarts@^4.9.0:
version "4.9.0"
resolved "https://registry.nlark.com/echarts/download/echarts-4.9.0.tgz?cache=0&sync_timestamp=1632191355993&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fecharts%2Fdownload%2Fecharts-4.9.0.tgz#a9b9baa03f03a2a731e6340c55befb57a9e1347d"
resolved "https://registry.npmmirror.com/echarts/download/echarts-4.9.0.tgz?cache=0&sync_timestamp=1635741929711&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fecharts%2Fdownload%2Fecharts-4.9.0.tgz#a9b9baa03f03a2a731e6340c55befb57a9e1347d"
integrity sha1-qbm6oD8Doqcx5jQMVb77V6nhNH0=
dependencies:
zrender "4.3.2"

Loading…
Cancel
Save