陈鹏飞 3 years ago
parent
commit
c314fc9176
  1. 3
      src/app/babylon/controller/config-manager.ts
  2. 42
      src/app/babylon/model/info/model/model-info.ts
  3. 12
      src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts
  4. BIN
      src/assets/images/facility/in/JY_JYJ.png
  5. BIN
      src/assets/images/facility/in/JY_YG.png

3
src/app/babylon/controller/config-manager.ts

@ -43,7 +43,10 @@ export class ConfigManager {
case FacilityType.QY:
case FacilityType.TPBZ:
case FacilityType.DWBZ:
case FacilityType.JY_JYJ://临时
case FacilityType.JY_YG://临时
result = true;
break;
}

42
src/app/babylon/model/info/model/model-info.ts

@ -5,6 +5,7 @@ import {
EventState,
Mesh,
PointerDragBehavior,
Vector2,
Vector3,
} from '@babylonjs/core';
import { Button, Rectangle, Vector2WithInfo } from '@babylonjs/gui';
@ -14,6 +15,8 @@ import { UIManager } from 'src/app/babylon/controller/ui-manager';
import { BabylonTool } from 'src/app/babylon/tool/babylon-tool';
import { BabylonUIStyleTool } from 'src/app/babylon/tool/babylon-ui-style-tool';
import { GizmoTool } from 'src/app/babylon/tool/gizmo-tool';
import { TsTool } from 'src/app/babylon/tool/ts-tool';
import { isRegularExpressionLiteral } from 'typescript';
import { ModelData } from '../../data/model-data/model-data';
@ -26,6 +29,11 @@ export class ModelInfo {
*
*/
_models: AbstractMesh[];
/**
*
*/
head: AbstractMesh;
/**
* 使modelBox 访
*/
@ -251,8 +259,23 @@ export class ModelInfo {
if (this.uiFollowRoot != null) {
this.uiFollowRoot.linkWithMesh(this.modelBox);
this.uiFollowRoot.linkOffsetY = '-50px';
for (let i = 0; i < this.models.length; i++) {
let l_mesh = this.models[i];
if (TsTool.stringContain(l_mesh.name, "Head")) {
this.head = l_mesh;
break;
}
}
if (this.head == null) {
this.uiFollowRoot.linkWithMesh(this.modelBox);
this.uiFollowRoot.linkOffsetY = '-50px';
}
else {
this.uiFollowRoot.linkWithMesh(this.head);
}
}
}
@ -285,6 +308,21 @@ export class ModelInfo {
}
/**
* ui所在的位置
*/
getHeadUIPos() {
let result: Vector2 = null;
if (this.uiFollowRoot != null) {
result.x = this.uiFollowRoot.leftInPixels;
result.y = this.uiFollowRoot.topInPixels;
}
return result;
}
}

12
src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts

@ -134,5 +134,17 @@ export class FacilityInfoUIItem {
}
/**
* UI的位置
*/
getHeadUIPos() {
if (this.modelInfo != null) {
return this.modelInfo.getHeadUIPos();
}
else {
return null;
}
}
}

BIN
src/assets/images/facility/in/JY_JYJ.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/assets/images/facility/in/JY_YG.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Loading…
Cancel
Save