1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00

Fix being able to create constant signals without value

This commit is contained in:
tobspr 2020-08-28 22:56:56 +02:00
parent 7cbe5bb8e7
commit a67448fbdf
2 changed files with 573 additions and 563 deletions

View File

@ -368,9 +368,18 @@ export class DialogWithForm extends Dialog {
* @param {array=} param0.buttons * @param {array=} param0.buttons
* @param {string=} param0.confirmButtonId * @param {string=} param0.confirmButtonId
* @param {string=} param0.extraButton * @param {string=} param0.extraButton
* @param {boolean=} param0.closeButton
* @param {Array<FormElement>} param0.formElements * @param {Array<FormElement>} param0.formElements
*/ */
constructor({ app, title, desc, formElements, buttons = ["cancel", "ok:good"], confirmButtonId = "ok" }) { constructor({
app,
title,
desc,
formElements,
buttons = ["cancel", "ok:good"],
confirmButtonId = "ok",
closeButton = true,
}) {
let html = ""; let html = "";
html += desc + "<br>"; html += desc + "<br>";
for (let i = 0; i < formElements.length; ++i) { for (let i = 0; i < formElements.length; ++i) {
@ -383,7 +392,7 @@ export class DialogWithForm extends Dialog {
contentHTML: html, contentHTML: html,
buttons: buttons, buttons: buttons,
type: "info", type: "info",
closeButton: true, closeButton,
}); });
this.confirmButtonId = confirmButtonId; this.confirmButtonId = confirmButtonId;
this.formElements = formElements; this.formElements = formElements;

View File

@ -52,6 +52,7 @@ export class ConstantSignalSystem extends GameSystemWithFilter {
desc: "Enter a shape code, color or '0' or '1'", desc: "Enter a shape code, color or '0' or '1'",
formElements: [signalValueInput], formElements: [signalValueInput],
buttons: ["cancel:bad:escape", "ok:good:enter"], buttons: ["cancel:bad:escape", "ok:good:enter"],
closeButton: false,
}); });
this.root.hud.parts.dialogs.internalShowDialog(dialog); this.root.hud.parts.dialogs.internalShowDialog(dialog);