Can play Sound from a map script
add sound in the TutoMap
This commit is contained in:
parent
676dbcc9d0
commit
517c0e86cb
6 changed files with 92 additions and 0 deletions
|
@ -9,6 +9,8 @@ import {ClosePopupEvent} from "./Api/Events/ClosePopupEvent";
|
|||
import {OpenTabEvent} from "./Api/Events/OpenTabEvent";
|
||||
import {GoToPageEvent} from "./Api/Events/GoToPageEvent";
|
||||
import {OpenCoWebSiteEvent} from "./Api/Events/OpenCoWebSiteEvent";
|
||||
import {PlaySoundEvent} from "./Api/Events/PlaySoundEvent";
|
||||
import SoundConfig = Phaser.Types.Sound.SoundConfig;
|
||||
|
||||
interface WorkAdventureApi {
|
||||
sendChatMessage(message: string, author: string): void;
|
||||
|
@ -24,6 +26,7 @@ interface WorkAdventureApi {
|
|||
restorePlayerControl() : void;
|
||||
displayBubble() : void;
|
||||
removeBubble() : void;
|
||||
playSound(url : string, config : SoundConfig): void;
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
@ -113,6 +116,18 @@ window.WA = {
|
|||
},'*');
|
||||
},
|
||||
|
||||
playSound(url: string, config : SoundConfig) : string{
|
||||
window.parent.postMessage({
|
||||
"type" : 'playSound',
|
||||
"data": {
|
||||
url,
|
||||
config
|
||||
} as PlaySoundEvent
|
||||
|
||||
},'*');
|
||||
return url;
|
||||
},
|
||||
|
||||
goToPage(url : string) : void{
|
||||
window.parent.postMessage({
|
||||
"type" : 'goToPage',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue