prettier
This commit is contained in:
@@ -6,7 +6,8 @@ export const isButtonClickedEvent = new tg.IsInterface()
|
||||
buttonId: tg.isNumber,
|
||||
input: tg.isBoolean,
|
||||
inputValue: tg.isString,
|
||||
}).get();
|
||||
})
|
||||
.get();
|
||||
/**
|
||||
* A message sent from the game to the iFrame when a user enters or leaves a zone marked with the "zone" property.
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,8 @@ export const isClosePopupEvent = new tg.IsInterface()
|
||||
.withProperties({
|
||||
popupId: tg.isNumber,
|
||||
inputValue: tg.isString,
|
||||
}).get();
|
||||
})
|
||||
.get();
|
||||
|
||||
/**
|
||||
* A message sent from the iFrame to the game to add a message in the chat.
|
||||
|
||||
@@ -13,9 +13,10 @@ export const isOpenPopupEvent = new tg.IsInterface()
|
||||
targetObject: tg.isString,
|
||||
message: tg.isString,
|
||||
buttons: tg.isArray(isButtonDescriptor),
|
||||
popupClass : tg.isString,
|
||||
input: tg.isBoolean
|
||||
}).get();
|
||||
popupClass: tg.isString,
|
||||
input: tg.isBoolean,
|
||||
})
|
||||
.get();
|
||||
|
||||
/**
|
||||
* A message sent from the iFrame to the game to add a message in the chat.
|
||||
|
||||
@@ -283,7 +283,7 @@ class IframeListener {
|
||||
|
||||
unregisterIframe(iframe: HTMLIFrameElement): void {
|
||||
this._unregisterIFrameStream.next();
|
||||
this.iframeCloseCallbacks.get(iframe)?.forEach(callback => {
|
||||
this.iframeCloseCallbacks.get(iframe)?.forEach((callback) => {
|
||||
callback();
|
||||
});
|
||||
this.iframes.delete(iframe);
|
||||
@@ -478,7 +478,7 @@ class IframeListener {
|
||||
});
|
||||
}
|
||||
|
||||
sendButtonClickedEvent(popupId: number, buttonId: number, input : boolean, inputValue : string | null): void {
|
||||
sendButtonClickedEvent(popupId: number, buttonId: number, input: boolean, inputValue: string | null): void {
|
||||
this.postMessage({
|
||||
type: "buttonClickedEvent",
|
||||
data: {
|
||||
@@ -486,7 +486,7 @@ class IframeListener {
|
||||
buttonId,
|
||||
input,
|
||||
inputValue,
|
||||
} as ButtonClickedEvent
|
||||
} as ButtonClickedEvent,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@ import { sendToWorkadventure } from "../IframeApiContribution";
|
||||
import type { ClosePopupEvent } from "../../Events/ClosePopupEvent";
|
||||
|
||||
export class Popup {
|
||||
|
||||
inputValue: string;
|
||||
|
||||
constructor(private id: number) {
|
||||
this.inputValue = '';
|
||||
this.inputValue = "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14,11 +13,11 @@ export class Popup {
|
||||
*/
|
||||
public close(): void {
|
||||
sendToWorkadventure({
|
||||
'type': 'closePopup',
|
||||
'data': {
|
||||
'popupId': this.id,
|
||||
'inputValue': this.inputValue,
|
||||
} as ClosePopupEvent
|
||||
type: "closePopup",
|
||||
data: {
|
||||
popupId: this.id,
|
||||
inputValue: this.inputValue,
|
||||
} as ClosePopupEvent,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,12 +131,13 @@ export class WorkadventureRoomCommands extends IframeApiContribution<Workadventu
|
||||
}
|
||||
|
||||
async getProperty(layerName: string, propertyName: string): Promise<string | number | boolean | undefined> {
|
||||
const event = await queryWorkadventure({
|
||||
type: "getProperty", data: {
|
||||
const event = await queryWorkadventure({
|
||||
type: "getProperty",
|
||||
data: {
|
||||
layerName: layerName,
|
||||
propertyName: propertyName,
|
||||
propertyValue : undefined,
|
||||
}
|
||||
propertyValue: undefined,
|
||||
},
|
||||
});
|
||||
return event.propertyValue;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,13 @@ export class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventure
|
||||
}),
|
||||
];
|
||||
|
||||
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[], popupClass : string = "", input: boolean = false): Popup {
|
||||
openPopup(
|
||||
targetObject: string,
|
||||
message: string,
|
||||
buttons: ButtonDescriptor[],
|
||||
popupClass: string = "",
|
||||
input: boolean = false
|
||||
): Popup {
|
||||
popupId++;
|
||||
const popup = new Popup(popupId);
|
||||
const btnMap = new Map<number, () => void>();
|
||||
@@ -114,7 +120,7 @@ export class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventure
|
||||
};
|
||||
}),
|
||||
popupClass,
|
||||
input
|
||||
input,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user