邵佳豪 4 years ago
parent
commit
3d5cdfbae8
  1. 1
      debug.log
  2. 3
      src/app/working-area/model/gameMode.ts
  3. 85
      src/app/working-area/working-area.component.ts

1
debug.log

@ -0,0 +1 @@
[1225/112746.821:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)

3
src/app/working-area/model/gameMode.ts

@ -3,5 +3,6 @@
*/
export enum GameMode {
BasicInformation,
Assignment
Assignment,
Examinee
}

85
src/app/working-area/working-area.component.ts

@ -15,7 +15,6 @@ import { AxShape } from './model/axShape';
import { PropertyInfo } from './model/PropertyInfo';
import { AxPreviewImageShape } from './model/axPreviewImageShape';
import { AxArrowConnector } from './model/axArrowConnector';
import { Legend } from './model/legend';
@Component({
@ -274,7 +273,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.animator.update();
this.mousePosition = this.app.renderer.plugins.interaction.mouse.global;
// 预览图片
if (this.previewImage !== null) {
if (this.previewImage !== null && this.backgroundImage !== null) {
this.previewImage.position = this.backgroundImage.toLocal(this.mousePosition);
}
@ -391,17 +390,19 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*
*/
this.on('createIcon', obj => {
if (obj.assetData.GameMode === GameMode.BasicInformation) {
if (obj.assetData.GameMode === GameMode.BasicInformation) { // 基本信息
// 添加楼层数据
this.canvasData.originaleveryStoreyData.data[obj.assetData.Id] = obj.assetData;
// 添加建筑数据
this.canvasData.originalcompanyBuildingData.data[obj.assetData.Id] = obj.assetData;
} else {
} else if(obj.assetData.GameMode === GameMode.Assignment){ // 处置预案
if (this.canvasData.selectPanelPoint.Data === undefined
|| this.canvasData.selectPanelPoint.Data === null) {
this.canvasData.selectPanelPoint.Data = new FloorNodeData();
}
this.canvasData.selectPanelPoint.Data.Stock[obj.assetData.Id] = obj.assetData;
} else if (obj.assetData.GameMode === GameMode.Examinee) { // 考生考试
// this.canvasData.examOriginaleveryStoreyData.data[obj.assetData.Id] = obj.assetData;
}
this.canvasData.isChange = true;
});
@ -474,30 +475,39 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.selection.select(obj);
});
}
/**
*
*/
// /**
// * 刷新工作区
// */
public async refresh() {
this.setPaintMode(PaintMode.endPaint);
this.resetCanvas();
this.destroyBackgroundImage();
if (!this.canvasData.selectStorey.imageUrl) {
return;
}
await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl);
this.createFloorShape();
this.createBuildingShape();
this.createFloorShape(this.canvasData.originaleveryStoreyData.data);
if (this.canvasData.gameMode === GameMode.Assignment) {
this.createWorkNode();
this.createNodeShape(this.canvasData.selectPanelPoint.Data);
}
this.emit('backgroundScale', this.backgroundImage.scale.x);
// await this.createBackground(this.canvasData.selectStorey.imageUrl);
}
/**
*
*/
public async createBackground(imageUrl:string) {
if (this.backgroundImage !== null) {
this.destroyBackgroundImage();
}
await this.createBackgroundImage(imageUrl)
}
/**
*
*/
private createFloorShape() {
const floorData = this.canvasData.originaleveryStoreyData.data;
public createFloorShape(floorData: any) {
Object.keys(floorData).forEach((key) => {
switch (floorData[key].InteractiveMode) {
case 0:
@ -521,42 +531,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
break;
}
});
this.emit('backgroundScale', this.backgroundImage.scale.x);
}
/**
*
*
*/
private createBuildingShape() {
const buildingData = this.canvasData.originalcompanyBuildingData.data;
const floor = this.canvasData.selectStorey;
Object.keys(buildingData).forEach((key) => {
if (buildingData[key].FloorId === floor.id) {
switch (buildingData[key].InteractiveMode) {
case 0:
const singleIcon = new AxImageShape(buildingData[key], this);
singleIcon.moveable = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode;
break;
case 1:
const icon = new MultipointIcon(buildingData[key], this);
break;
case 2:
const polygonIcon = new PolygonIcon(buildingData[key], this);
break;
case 3:
if (buildingData[key].Name === '水带') {
const distance = new AxArrowConnector(buildingData[key], this, false, true);
} else if (buildingData[key].Name === '距离') {
const distance = new AxArrowConnector(buildingData[key], this, true, true);
} else if (buildingData[key].Name === '普通墙' || buildingData[key].Name === '承重墙') {
const wall = new AxArrowConnector(buildingData[key], this, false, false);
}
break;
}
}
});
}
private createWorkNode() {
// 加载处置节点数据
const nodeData = this.canvasData.selectPanelPoint.Data;
public createNodeShape(nodeData: any) {
if (nodeData !== undefined && nodeData !== null) {
Object.keys(nodeData).forEach((key) => {
Object.keys(nodeData[key]).forEach((tempKey) => {
@ -578,6 +558,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
});
});
}
this.emit('backgroundScale', this.backgroundImage.scale.x);
}
/**
*
@ -649,7 +630,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
/**
*
*/
private async createBackgroundImage(imageUrl: string): Promise<void> {
public async createBackgroundImage(imageUrl: string): Promise<void> {
const image = await PIXI.Texture.fromURL(imageUrl);
this.backgroundImage = new PIXI.Sprite(image);
this.backgroundImage.anchor.set(0.5);
@ -957,10 +938,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
if (!this.canvasData.selectStorey.imageUrl) {
this.backgroundImage.visible = false;
} else {
// this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl);
// this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle;
// this.backgroundImage.visible = true;
this.refresh();
this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl);
this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle;
this.backgroundImage.visible = true;
// this.refresh();
}
}
/**
@ -968,6 +949,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*/
public destroyBackgroundImage(): void {
this.app.stage.removeChild(this.backgroundImage);
this.backgroundImage = null;
}
/**
*
@ -1046,6 +1028,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*
*/
public beginPaint() {
console.log(this.canvasData.selectTemplateData);
this.selection.deselectAll();
this.setPaintMode(PaintMode.endPaint);
this.setPaintMode(this.canvasData.selectTemplateData.interactiveMode);

Loading…
Cancel
Save