|
|
|
@ -33,6 +33,7 @@ import { HttpClient } from '@angular/common/http';
|
|
|
|
|
import { DataBuffer } from '@babylonjs/core'; |
|
|
|
|
import { Photo360Tool } from 'src/app/babylon/tool/photo360-tool'; |
|
|
|
|
import { SpeakingTool } from 'src/app/babylon/tool/speaking-tool'; |
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -42,11 +43,7 @@ import { SpeakingTool } from 'src/app/babylon/tool/speaking-tool';
|
|
|
|
|
styleUrls: ['./plan.component.scss', './publicPop.scss'] |
|
|
|
|
}) |
|
|
|
|
export class PlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private element: ElementRef, private buildingBISrv: BuildingBasicInfosService, private objectsSrv: ObjectsService, private eventManager: EventManager, private message: NzMessageService, private http: HttpClient) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private element: ElementRef, private buildingBISrv: BuildingBasicInfosService, private objectsSrv: ObjectsService, private eventManager: EventManager, private message: NzMessageService, private http: HttpClient, private fb: FormBuilder) { } |
|
|
|
|
static instance: PlanComponent; |
|
|
|
|
public game: Game; |
|
|
|
|
public beforeOneSatus; //当前 satus
|
|
|
|
@ -60,7 +57,14 @@ export class PlanComponent implements OnInit {
|
|
|
|
|
private readonly c_frameSpace = 16;//更新的帧间隔, 16大概是60帧每秒
|
|
|
|
|
private lasteUpdateTime = 0;//上次更新的时间(毫秒)
|
|
|
|
|
|
|
|
|
|
validateForm!: FormGroup; |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.validateForm = this.fb.group({ |
|
|
|
|
name: [null, [Validators.required]], |
|
|
|
|
modelType: [null, [Validators.required]] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlanComponent.instance = this; |
|
|
|
|
ServeManager.Init(this.buildingBISrv, this.objectsSrv); |
|
|
|
|
this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement; |
|
|
|
@ -338,7 +342,12 @@ export class PlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//创建/编辑建筑
|
|
|
|
|
addModelBuilding(e: modelBuilding) { |
|
|
|
|
addModelBuilding() { |
|
|
|
|
if(!this.validateForm.valid){ |
|
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
let e: modelBuilding = this.validateForm.value |
|
|
|
|
if (this.addBuildingPop) { //新增
|
|
|
|
|
let order = this.buildingUIItems.length + 1; |
|
|
|
|
this.beforeOneSatus = StatusManager.getStatus<BuildingStatus>(BuildingStatus); |
|
|
|
@ -359,6 +368,7 @@ export class PlanComponent implements OnInit {
|
|
|
|
|
//打开编辑建筑 弹窗
|
|
|
|
|
editModelBuilding(event, e: BuildingUIItem) { |
|
|
|
|
event.stopPropagation() |
|
|
|
|
console.log('打开弹窗', e) |
|
|
|
|
this.modelBuilding.name = JSON.parse(JSON.stringify(e.getBuildingName())) |
|
|
|
|
this.modelBuilding.modelType = JSON.parse(JSON.stringify(e.getBuildingType())) |
|
|
|
|
this.editBuildingPop = e; //打开弹窗
|
|
|
|
|