刘向辉 3 years ago
parent
commit
8355e50f0e
  1. 26
      README.md
  2. 97
      src/app/babylon/model/info/mark/other/mark-plan-multi-arrow.ts

26
README.md

@ -4,6 +4,32 @@
### 🌻 简介
> 时间:2021、12、16 周四
> 根据中化业务需求及建议,调整、优化
### 🌻 详情
> 前端部分
- [🚩 重大变更] 无
- [🌱 新增] 添加加油机、油罐根据名称排序的功能
- [🍀 完善] 油罐 UI 列表取消“数量”字段
- [🍀 完善] 消防设备列表中数目增加单位
- [🍀 完善] 取消消防设备外其他设备的高亮效果,只有选中时才高亮,优化显示效果
- [🍀 完善] 应急预案中,主角的 UI 用红色突出,可以设置的功能
- [🍀 完善] 完善模板的应急预案(油箱口着火)中的细节与表现
- [🍀 完善] 优化进攻路线箭头的表现,增加流动动画
> 三维部分
- [🚩 重大变更] 无
- [🌱 新增]
- [🍀 完善] 无
## 🌼v1.0.4 主要变化 babylon 完全离线方案,部署测试
### 🌻 简介
> 时间:2021、12、10 周五
> 修复 bug,babylon 离线方案(asset)测试

97
src/app/babylon/model/info/mark/other/mark-plan-multi-arrow.ts

@ -1,4 +1,4 @@
import { Color3, MeshBuilder, Quaternion, Space, Vector3 } from "@babylonjs/core";
import { Color3, MeshBuilder, Quaternion, Scene, Space, Vector3 } from "@babylonjs/core";
import { PointerEventTypes, PointerInfo } from "@babylonjs/core/Events/pointerEvents";
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
@ -27,6 +27,9 @@ export class ModelInfo_mark_multiArrow extends ModelInfo_mark {
arrowInfo: ArrowInfo[] = [];
mat: StandardMaterial;
mat_Light: StandardMaterial;
updateObserver: Observer<Scene>; //update的观察者
onCreate(isNew: boolean) {
@ -57,7 +60,8 @@ export class ModelInfo_mark_multiArrow extends ModelInfo_mark {
this.mat.disableLighting = false;
this.mat_Light = this.mat.clone(this.mat.name + "_light");
this.mat_Light.diffuseColor = Color3.FromHexString("#0000FF");
if (isNew) {
instance.arrowData.pointData = [];
@ -76,6 +80,21 @@ export class ModelInfo_mark_multiArrow extends ModelInfo_mark {
instance.updateRender();
}
this.updateObserver = SceneManager.Instance.scene.onBeforeRenderObservable.add((eventData: Scene, eventState: EventState) => {
instance.onUpdate(instance, eventData, eventState);
});
}
/**
*
* @param eventData
* @param eventState
*/
onUpdate(instance: ModelInfo_mark_multiArrow, eventData: Scene, eventState: EventState) {
instance.updateAnim();
}
/**
@ -139,6 +158,8 @@ export class ModelInfo_mark_multiArrow extends ModelInfo_mark {
SceneManager.Instance.scene.onPointerObservable.remove(this.onPointObserver);
this.onPointObserver = null;
}
}
/**
@ -233,12 +254,80 @@ export class ModelInfo_mark_multiArrow extends ModelInfo_mark {
if (this.mat != null) {
this.mat.dispose();
}
if (this.updateObserver != null) {
SceneManager.Instance.scene.onBeforeRenderObservable.remove(this.updateObserver);
this.updateObserver = null;
}
this.removeEvent();
super.dispose();
}
//#region 箭头动画
animIndex = -1;
readonly c_animTimer = 10;
animTimer = 0;
/**
*
*/
updateAnim() {
if (this.animTimer > 0) {
this.animTimer -= SceneManager.Instance.scene.deltaTime;
return;
}
else {
this.animTimer = this.c_animTimer;
// if (arrowNum > this.animIndex) {
// this.animIndex++;
// }
// else {
// this.animIndex = -1;
// }
this.animIndex = this.showArrow(this.animIndex);
}
}
/**
*
* @param animIndex
* index +1-1
*/
showArrow(animIndex: number) {
if (this.arrowInfo == null) {
return -1;
}
let index = -1;
let result = -1;
for (let i = 0; i < this.arrowInfo.length; i++) {
let arrowInfo = this.arrowInfo[i].mesh;
if (arrowInfo != null) {
for (let j = 0; j < arrowInfo.length; j++) {
index++;
// arrowInfo[j].setEnabled(index != animIndex);
if (index == animIndex) {
arrowInfo[j].material = this.mat_Light;
result = index;
}
else {
arrowInfo[j].material = this.mat;
}
}
}
}
return result + 1;
}
//#endregion
}
/**
@ -264,6 +353,8 @@ class ArrowInfo {
endlocalY: number; //局部的Y做坐标,末尾
mat: StandardMaterial;
constructor(start: Vector3, end: Vector3, mat: StandardMaterial, parent: Mesh) {
this.start = start;
this.end = end;

Loading…
Cancel
Save