mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Level class created and gravity editable.
This commit is contained in:
@@ -41,7 +41,7 @@ export default class Dialog
|
||||
return button;
|
||||
}
|
||||
|
||||
createInputNumber(label, value = 0, min = 0, max = 999999)
|
||||
createInputNumber(label, value = 0, min = 0, max = 999999, step = 1)
|
||||
{
|
||||
let htmlElement = document.createElement('div');
|
||||
htmlElement.classList.add('dialog-input-area');
|
||||
@@ -54,6 +54,9 @@ export default class Dialog
|
||||
htmlElementInput.classList.add('dialog-input');
|
||||
htmlElementInput.type = 'number';
|
||||
htmlElementInput.value = value;
|
||||
htmlElementInput.max = max;
|
||||
htmlElementInput.min = min;
|
||||
htmlElementInput.step = step;
|
||||
|
||||
htmlElement.appendChild(htmlElementLabel);
|
||||
htmlElement.appendChild(htmlElementInput);
|
||||
|
||||
22
tilorswift/js/dialog/DialogGravity.js
Normal file
22
tilorswift/js/dialog/DialogGravity.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import Dialog from "./Dialog.js";
|
||||
import TilorswiftGravityUpdatedEvent from "../events/TilorswiftGravityUpdatedEvent.js";
|
||||
|
||||
export default class DialogGravity extends Dialog
|
||||
{
|
||||
constructor(gravity)
|
||||
{
|
||||
super();
|
||||
this.setMessage('Gravitation einstellen');
|
||||
this.inputGravity = this.createInputNumber('Stärke', gravity, 0, 10, 0.01);
|
||||
this.createButton('Abbrechen');
|
||||
this.buttonOk = this.createButton('OK');
|
||||
this.buttonOk.addEventListener(
|
||||
'click',
|
||||
() => {
|
||||
window.dispatchEvent(
|
||||
new TilorswiftGravityUpdatedEvent(parseFloat(this.inputGravity.value))
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user