parameter soundConfig is now optionnal
if user call mySound.play() the sound will be played with the base SoundConfig
This commit is contained in:
parent
f03f8076f3
commit
b79d76fc2e
@ -15,7 +15,7 @@ const isSoundConfig =
|
|||||||
export const isPlaySoundEvent =
|
export const isPlaySoundEvent =
|
||||||
new tg.IsInterface().withProperties({
|
new tg.IsInterface().withProperties({
|
||||||
url: tg.isString,
|
url: tg.isString,
|
||||||
config : isSoundConfig,
|
config : tg.isOptional(isSoundConfig),
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,11 +24,10 @@ class SoundManager {
|
|||||||
return soundPromise;
|
return soundPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async playSound(loadPlugin: LoaderPlugin, soundManager : BaseSoundManager, soundUrl: string, config: SoundConfig) : Promise<void> {
|
public async playSound(loadPlugin: LoaderPlugin, soundManager : BaseSoundManager, soundUrl: string, config: SoundConfig|undefined) : Promise<void> {
|
||||||
const sound = await this.loadSound(loadPlugin,soundManager,soundUrl);
|
const sound = await this.loadSound(loadPlugin,soundManager,soundUrl);
|
||||||
sound.play(config);
|
if (config === undefined) sound.play();
|
||||||
|
else sound.play(config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public stopSound(soundManager : BaseSoundManager,soundUrl : string){
|
public stopSound(soundManager : BaseSoundManager,soundUrl : string){
|
||||||
|
@ -62,18 +62,6 @@
|
|||||||
"x":0,
|
"x":0,
|
||||||
"y":0
|
"y":0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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
"opacity":1,
|
|
||||||
"type":"tilelayer",
|
|
||||||
"visible":true,
|
|
||||||
"width":20,
|
|
||||||
"x":0,
|
|
||||||
"y":0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"draworder":"topdown",
|
"draworder":"topdown",
|
||||||
"id":5,
|
"id":5,
|
||||||
@ -94,6 +82,38 @@
|
|||||||
"width":107.109375,
|
"width":107.109375,
|
||||||
"x":258.4453125,
|
"x":258.4453125,
|
||||||
"y":197.018229166667
|
"y":197.018229166667
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"height":19.296875,
|
||||||
|
"id":3,
|
||||||
|
"name":"",
|
||||||
|
"rotation":0,
|
||||||
|
"text":
|
||||||
|
{
|
||||||
|
"text":"Bonjour Monde",
|
||||||
|
"wrap":true
|
||||||
|
},
|
||||||
|
"type":"",
|
||||||
|
"visible":true,
|
||||||
|
"width":107.109375,
|
||||||
|
"x":-348.221354166667,
|
||||||
|
"y":257.018229166667
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"height":55.296875,
|
||||||
|
"id":4,
|
||||||
|
"name":"",
|
||||||
|
"rotation":0,
|
||||||
|
"text":
|
||||||
|
{
|
||||||
|
"text":"Play Sound Loop\nexit Zone Stop Sound \n",
|
||||||
|
"wrap":true
|
||||||
|
},
|
||||||
|
"type":"",
|
||||||
|
"visible":true,
|
||||||
|
"width":176.442708333333,
|
||||||
|
"x":243.778645833333,
|
||||||
|
"y":368.3515625
|
||||||
}],
|
}],
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
"type":"objectgroup",
|
"type":"objectgroup",
|
||||||
@ -102,7 +122,7 @@
|
|||||||
"y":0
|
"y":0
|
||||||
}],
|
}],
|
||||||
"nextlayerid":8,
|
"nextlayerid":8,
|
||||||
"nextobjectid":3,
|
"nextobjectid":5,
|
||||||
"orientation":"orthogonal",
|
"orientation":"orthogonal",
|
||||||
"properties":[
|
"properties":[
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user