import Dialog from "./Dialog.js"; import TilorswiftNewTerrainEvent from "../events/TilorswiftNewTerrainEvent.js"; import TilorswiftEvent from "../events/TilorswiftEvent.js"; export default class DialogNewTerrain extends Dialog { constructor() { super(); this.setMessage('Neues Terrain erstellen'); this.inputRows = this.createInputNumber('Zeilen'); this.inputColumns = this.createInputNumber('Spalten'); this.inputTerrain = this.createTilesetSelector(); this.buttonCancel = this.createButton('Abbrechen'); this.buttonCreate = this.createButton('Erstellen'); this.terrainIndex = 0; this.buttonCreate.addEventListener( 'click', () => { window.dispatchEvent( new TilorswiftNewTerrainEvent( this.terrainIndex, this.inputColumns.value, this.inputRows.value ) ); } ); window.addEventListener( TilorswiftEvent.TILESET_SELECTED, (event) => { this.terrainIndex = event.tilesetIndex; } ); } }