Browse Source

加油机属性跟随优化

dev
刘向辉 3 years ago
parent
commit
a85be09c8a
  1. 2
      src/app/babylon/controller/config-manager.ts
  2. 7
      src/app/babylon/model/info/model/model-info-facility.ts
  3. 1
      src/app/babylon/model/info/model/model-info.ts
  4. 17
      src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts
  5. 24
      src/app/pages/plan/plan.component.ts

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

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

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

@ -47,15 +47,18 @@ export class ModelInfo_facility extends ModelInfo {
onCreateFollowUI() { onCreateFollowUI() {
let facilityData = this.modelData as ModelData_facility; let facilityData = this.modelData as ModelData_facility;
super.onCreateFollowUI();
BabylonUIStyleTool.setStyle_size(this.uiFollowRoot, ConfigManager.c_size_facilityIconSize + "px", ConfigManager.c_size_facilityIconSize + "px");
if (!ConfigManager.getFacilityNeedIcon(facilityData.facilityType)) { if (!ConfigManager.getFacilityNeedIcon(facilityData.facilityType)) {
return; return;
} }
super.onCreateFollowUI();
let instance = this; let instance = this;
let posType = ConfigManager.getPosType(facilityData.facilityType); let posType = ConfigManager.getPosType(facilityData.facilityType);
let iconPath = ConfigManager.getFacilityIconUrl(facilityData.facilityType, posType); let iconPath = ConfigManager.getFacilityIconUrl(facilityData.facilityType, posType);
BabylonUIStyleTool.setStyle_size(this.uiFollowRoot, ConfigManager.c_size_facilityIconSize + "px", ConfigManager.c_size_facilityIconSize + "px");
this.uiFollowRoot.thickness = 0; this.uiFollowRoot.thickness = 0;

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

@ -144,6 +144,7 @@ export class ModelInfo {
onCreateFollowUI() { onCreateFollowUI() {
this.uiFollowRoot = new Rectangle('follow_' + this.key); this.uiFollowRoot = new Rectangle('follow_' + this.key);
this.uiFollowRoot.thickness = 0;
UIManager.Instance.uiRoot.addControl(this.uiFollowRoot); UIManager.Instance.uiRoot.addControl(this.uiFollowRoot);
} }

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

@ -96,6 +96,7 @@ export class FacilityInfoUIItem {
this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], true); this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], true);
this.modelInfo.setIconEnable(select); this.modelInfo.setIconEnable(select);
this.facilityInfoInSceneWindow.playJYJSelectEffect(select, this.modelInfo) this.facilityInfoInSceneWindow.playJYJSelectEffect(select, this.modelInfo)
this.setHeadUICurrentPos();
} }
else { else {
this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], false); this.facilityInfoInSceneWindow.selectFacilityItemToThree([this], false);
@ -137,18 +138,32 @@ export class FacilityInfoUIItem {
} }
/**
* ui位置
*/
currentUIPos: Vector2 = Vector2.Zero();
/** /**
* UI的位置 * UI的位置
*/ */
getHeadUIPos(): Vector2 { getHeadUIPos(): Vector2 {
if (this.modelInfo != null) { if (this.modelInfo != null) {
return this.modelInfo.getHeadUIPos();
this.currentUIPos = Vector2.Lerp(this.currentUIPos, this.modelInfo.getHeadUIPos(), 0.3);
return this.currentUIPos;
} }
else { else {
return null; return null;
} }
} }
/**
* UI当前位置起点
*/
setHeadUICurrentPos() {
this.currentUIPos = this.modelInfo.getHeadUIPos();
}
} }

24
src/app/pages/plan/plan.component.ts

@ -30,6 +30,7 @@ import { Event_GetAllMarkPlanData } from 'src/app/babylon/controller/event-manag
import { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window'; import { FacilityInfoInSceneWindow } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window';
import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility'; import { FacilityType } from 'src/app/babylon/model/data/model-data/model-data-facility';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { DataBuffer } from '@babylonjs/core';
@ -54,6 +55,8 @@ export class PlanComponent implements OnInit {
public isShowLoading: boolean = true; //显隐 loading加载条 public isShowLoading: boolean = true; //显隐 loading加载条
public companyData: any; //当前加油站所属组织机构 data public companyData: any; //当前加油站所属组织机构 data
private readonly c_frameSpace = 16;//更新的帧间隔, 16大概是60帧每秒
private lasteUpdateTime = 0;//上次更新的时间(毫秒)
ngOnInit(): void { ngOnInit(): void {
PlanComponent.instance = this; PlanComponent.instance = this;
@ -79,6 +82,9 @@ export class PlanComponent implements OnInit {
} }
}) })
//监听 delete键盘事件 //监听 delete键盘事件
this.game.scene.onBeforeRenderObservable.add(() => {
PlanComponent.instance.ngAfterViewCheckedA();
})
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
@ -123,7 +129,16 @@ export class PlanComponent implements OnInit {
}) })
} }
ngAfterViewChecked () { /**
*
*/
ngAfterViewCheckedA() {
let currentTime = new Date().getTime();
let space = currentTime - this.lasteUpdateTime;
if (space < this.c_frameSpace) {
return;
}
this.lasteUpdateTime = currentTime;
if (this.isShowNature && this.beforeOnePropertyData && (this.selectFence === 1 || this.selectFence === 2)) { //刷新弹窗 位置 if (this.isShowNature && this.beforeOnePropertyData && (this.selectFence === 1 || this.selectFence === 2)) { //刷新弹窗 位置
this.renovateDialogPosition() this.renovateDialogPosition()
} }
@ -403,10 +418,12 @@ export class PlanComponent implements OnInit {
//刷新设备属性 弹窗位置 //刷新设备属性 弹窗位置
renovateDialogPosition() { renovateDialogPosition() {
window.setTimeout(()=>{ // window.setTimeout(() => {
this.naturePosition.left = `${this.beforeOnePropertyData.getHeadUIPos().x - 150}px` this.naturePosition.left = `${this.beforeOnePropertyData.getHeadUIPos().x - 150}px`
this.naturePosition.top = `${this.beforeOnePropertyData.getHeadUIPos().y + 100}px` this.naturePosition.top = `${this.beforeOnePropertyData.getHeadUIPos().y + 100}px`
},0) // }, 0)
} }
//上传设备 图片 //上传设备 图片
@ -855,6 +872,7 @@ export class taskList {
export class naturePosition { export class naturePosition {
top: string = "0px" top: string = "0px"
left: string = "0px" left: string = "0px"
} }
// 处置预案 所有图标 // 处置预案 所有图标
export class planIcons { export class planIcons {

Loading…
Cancel
Save