Merge pull request #883 from ClementVieilly75/FTUEPopup

Ftue popup
This commit is contained in:
David Négrier 2021-04-09 17:41:39 +02:00 committed by GitHub
commit a1f06ffbd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 24 deletions

View File

@ -727,9 +727,9 @@ export class GameScene extends ResizableScene implements CenterListener {
return; return;
} }
const escapedMessage = HtmlUtils.escapeHtml(openPopupEvent.message); const escapedMessage = HtmlUtils.escapeHtml(openPopupEvent.message);
let html = `<div id="container"><div class="nes-container with-title is-centered"> let html = `<div id="container" hidden><div class="nes-container with-title is-centered">
${escapedMessage} ${escapedMessage}
</div> </div>`; </div> `;
const buttonContainer = `<div class="buttonContainer"</div>`; const buttonContainer = `<div class="buttonContainer"</div>`;
html += buttonContainer; html += buttonContainer;
let id = 0; let id = 0;
@ -737,15 +737,18 @@ ${escapedMessage}
html += `<button type="button" class="nes-btn is-${HtmlUtils.escapeHtml(button.className ?? '')}" id="popup-${openPopupEvent.popupId}-${id}">${HtmlUtils.escapeHtml(button.label)}</button>`; html += `<button type="button" class="nes-btn is-${HtmlUtils.escapeHtml(button.className ?? '')}" id="popup-${openPopupEvent.popupId}-${id}">${HtmlUtils.escapeHtml(button.label)}</button>`;
id++; id++;
} }
const domElement = this.add.dom(objectLayerSquare.x + objectLayerSquare.width/2 , html += '</div>';
objectLayerSquare.y + objectLayerSquare.height/2).createFromHTML(html); const domElement = this.add.dom(objectLayerSquare.x ,
objectLayerSquare.y).createFromHTML(html);
const container : HTMLDivElement = domElement.getChildByID("container") as HTMLDivElement; const container : HTMLDivElement = domElement.getChildByID("container") as HTMLDivElement;
container.style.width = objectLayerSquare.width + "px"; container.style.width = objectLayerSquare.width + "px";
domElement.scale = 0; domElement.scale = 0;
domElement.setClassName('popUpElement'); domElement.setClassName('popUpElement');
setTimeout(() => {
(container).hidden = false;
}, 100);
id = 0; id = 0;
for (const button of openPopupEvent.buttons) { for (const button of openPopupEvent.buttons) {
@ -753,6 +756,7 @@ ${escapedMessage}
const btnId = id; const btnId = id;
button.onclick = () => { button.onclick = () => {
iframeListener.sendButtonClickedEvent(openPopupEvent.popupId, btnId); iframeListener.sendButtonClickedEvent(openPopupEvent.popupId, btnId);
button.disabled = true;
} }
id++; id++;
} }

View File

@ -278,8 +278,8 @@
"type":"", "type":"",
"visible":true, "visible":true,
"width":245.667, "width":245.667,
"x":1170, "x":1171,
"y":442 "y":412
}, },
{ {
"height":84.6667, "height":84.6667,
@ -289,8 +289,8 @@
"type":"", "type":"",
"visible":true, "visible":true,
"width":210.667, "width":210.667,
"x":966, "x":1030.5,
"y":327.66665 "y":318.66665
}, },
{ {
"height":99.6667, "height":99.6667,

File diff suppressed because one or more lines are too long