add input popup

This commit is contained in:
_Bastler
2021-05-16 14:04:45 +02:00
parent c6eee39057
commit c7623300f2
6 changed files with 81 additions and 60 deletions
@@ -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.
+1
View File
@@ -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();
/**
+2 -1
View File
@@ -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();
/**
+4 -2
View File
@@ -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
});
}