diff --git a/front/src/Api/Events/ButtonClickedEvent.ts b/front/src/Api/Events/ButtonClickedEvent.ts index de807037..1343aa0a 100644 --- a/front/src/Api/Events/ButtonClickedEvent.ts +++ b/front/src/Api/Events/ButtonClickedEvent.ts @@ -4,6 +4,8 @@ export const isButtonClickedEvent = new tg.IsInterface().withProperties({ popupId: tg.isNumber, buttonId: tg.isNumber, + input : tg.isBoolean, + inputValue : tg.isString, }).get(); /** * A message sent from the game to the iFrame when a user enters or leaves a zone marked with the "zone" property. diff --git a/front/src/Api/Events/ClosePopupEvent.ts b/front/src/Api/Events/ClosePopupEvent.ts index 83b09c96..db64474b 100644 --- a/front/src/Api/Events/ClosePopupEvent.ts +++ b/front/src/Api/Events/ClosePopupEvent.ts @@ -3,6 +3,7 @@ import * as tg from "generic-type-guard"; export const isClosePopupEvent = new tg.IsInterface().withProperties({ popupId: tg.isNumber, + inputValue : tg.isString, }).get(); /** diff --git a/front/src/Api/Events/OpenPopupEvent.ts b/front/src/Api/Events/OpenPopupEvent.ts index 094ba555..0abcd667 100644 --- a/front/src/Api/Events/OpenPopupEvent.ts +++ b/front/src/Api/Events/OpenPopupEvent.ts @@ -11,7 +11,8 @@ export const isOpenPopupEvent = popupId: tg.isNumber, targetObject: tg.isString, message: tg.isString, - buttons: tg.isArray(isButtonDescriptor) + buttons: tg.isArray(isButtonDescriptor), + input: tg.isBoolean }).get(); /** diff --git a/front/src/Api/IframeListener.ts b/front/src/Api/IframeListener.ts index bed65f2f..19d030b6 100644 --- a/front/src/Api/IframeListener.ts +++ b/front/src/Api/IframeListener.ts @@ -222,12 +222,14 @@ class IframeListener { }); } - sendButtonClickedEvent(popupId: number, buttonId: number): void { + sendButtonClickedEvent(popupId: number, buttonId: number, input : boolean, inputValue : string | null): void { this.postMessage({ 'type': 'buttonClickedEvent', 'data': { popupId, - buttonId + buttonId, + input, + inputValue, } as ButtonClickedEvent }); } diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 27ad414c..bcf997a4 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -794,9 +794,12 @@ export class GameScene extends ResizableScene implements CenterListener { return; } const escapedMessage = HtmlUtils.escapeHtml(openPopupEvent.message); - let html = `