2020-02-10 19:36:46 +01:00
|
|
|
import Dialog from "./Dialog.js";
|
|
|
|
import TilorswiftNewTerrainEvent from "../events/TilorswiftNewTerrainEvent.js";
|
2020-02-14 00:12:24 +01:00
|
|
|
import TilorswiftEvent from "../events/TilorswiftEvent.js";
|
2020-02-10 19:36:46 +01:00
|
|
|
|
|
|
|
export default class DialogNewTerrain extends Dialog
|
|
|
|
{
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.setMessage('Neues Terrain erstellen');
|
|
|
|
this.inputRows = this.createInputNumber('Zeilen');
|
|
|
|
this.inputColumns = this.createInputNumber('Spalten');
|
2020-02-14 00:12:24 +01:00
|
|
|
this.inputTerrain = this.createTilesetSelector();
|
2020-02-10 19:36:46 +01:00
|
|
|
this.buttonCancel = this.createButton('Abbrechen');
|
|
|
|
this.buttonCreate = this.createButton('Erstellen');
|
2020-02-14 00:12:24 +01:00
|
|
|
this.terrainIndex = 0;
|
2020-02-10 19:36:46 +01:00
|
|
|
|
|
|
|
this.buttonCreate.addEventListener(
|
|
|
|
'click',
|
|
|
|
() => {
|
|
|
|
window.dispatchEvent(
|
|
|
|
new TilorswiftNewTerrainEvent(
|
2020-02-14 00:12:24 +01:00
|
|
|
this.terrainIndex,
|
2020-02-10 19:36:46 +01:00
|
|
|
this.inputColumns.value,
|
|
|
|
this.inputRows.value
|
|
|
|
)
|
2020-02-14 00:12:24 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
window.addEventListener(
|
|
|
|
TilorswiftEvent.TILESET_SELECTED,
|
|
|
|
(event) => {
|
|
|
|
this.terrainIndex = event.tilesetIndex;
|
|
|
|
console.log(event.tilesetIndex);
|
2020-02-10 19:36:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|