From 22675945b90bf0c276dd0f8091ec3e2ca1adf9e6 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Thu, 11 Nov 2021 14:21:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=AF=B9=E6=8E=A5=E8=AE=BE?= =?UTF-8?q?=E5=A4=87UI=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/babylon/controller/config-manager.ts | 3 ++ .../babylon/model/info/model/model-info.ts | 42 +++++++++++++++++- .../facilityinfo-ui-item.ts | 12 +++++ src/assets/images/facility/in/JY_JYJ.png | Bin 0 -> 2239 bytes src/assets/images/facility/in/JY_YG.png | Bin 0 -> 2500 bytes 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 src/assets/images/facility/in/JY_JYJ.png create mode 100644 src/assets/images/facility/in/JY_YG.png diff --git a/src/app/babylon/controller/config-manager.ts b/src/app/babylon/controller/config-manager.ts index e724c8d..b136957 100644 --- a/src/app/babylon/controller/config-manager.ts +++ b/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; } diff --git a/src/app/babylon/model/info/model/model-info.ts b/src/app/babylon/model/info/model/model-info.ts index f89684a..eeea1de 100644 --- a/src/app/babylon/model/info/model/model-info.ts +++ b/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; + } + } diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts index 8acf483..96c3b87 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts +++ b/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; + } + } + } \ No newline at end of file diff --git a/src/assets/images/facility/in/JY_JYJ.png b/src/assets/images/facility/in/JY_JYJ.png new file mode 100644 index 0000000000000000000000000000000000000000..199063a26f65e9ad3eabd8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ypczV+V;Qw2imCM|#&yfHC N002ovPDHLkV1h8FRu%vN literal 0 HcmV?d00001 diff --git a/src/assets/images/facility/in/JY_YG.png b/src/assets/images/facility/in/JY_YG.png new file mode 100644 index 0000000000000000000000000000000000000000..f377b06ea5fcf47261a2e27475efbc353ba9b238 GIT binary patch literal 2500 zcmV;#2|M58`1cEmDmoeoo`S{=ta{?$=h zEljavm8n9ZMJ?2#AS#O#X$8s}Ado;v$V&FNFV64gyf@e6y}Wl{5|Y$@XWr!9oBMwE zcfR-h&h|T(Pw{^aQ&{}n*awpdD{wt9510jv2F3vsffV2pPz5vsr-8k|VW4ZUCUiTl z$ixN%W}pPP6PORo5uwdG(oMSWQ-I0xJp=@S4&WHD2iOLj0K5Y|*MZakC0sgiGw@wt zi5w3U4ghO_U7{KO{){`28ejuP0k;580!!uGK;u^V90c9~{tUE$NRlM_OF+J?>t}!k zgCKM?%$1L_6|VvBiVX=RGnhHaN!Vn~J`ZfXhQjMH9e4?NMYJ!e<(7;FC}VM(sQV&0 z9x9}WttkT50`CD=2a|wo;0|ClaMK`q5hGCAI2#xvpUtu)5`qx{3W5896+jta8B(!( z<2vA3(S~0E<%#?#Q3A3>_*HVF;Rurm|ESDO*@lbp=9!2Qw2RuW7{tr= zcX2!dtm5WYi`tJAsO9<{;BFwRKLn_7cBMpj!)?vS!}vtz-WLJ+!s4P4D0~pA%Vi6El{U?Xm&-WKriCLBd8PUdyML>>(w*#5X3>B=R$%WChAQ}Pc+>9X#ZwCu1 zKzcZu+m99p*u{86U^1IA*{ooSx{QV|f+2!_pY|7cTmq!Jcm&Ll_*#QGC580qWn_Kk zMog)xBTIgli?%}_;;y_%$nRG%%+tUN`fGX;V3xHX$>;48ODX-)3*;=AkEgblpxblJ z1n3W}jx18g7E$;6x47_wALFfWP@_E|8DwjC=$-_G%UBUubFxXhZUU`)_EP=wt9Tol zhQIVC6X}yDQu4#+NuM$qOM1kX7l?Lm44>#pz@1Uuo(Z~6mecajeGp2j?r_cFJb8*S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