1 |
- {"ast":null,"code":"import { Action } from \"./action.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * This defines an action helpful to play a defined sound on a triggered action.\n */\nexport class PlaySoundAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param sound defines the sound to play\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, sound, condition) {\n super(triggerOptions, condition);\n this._sound = sound;\n }\n /** @internal */\n _prepare() {}\n /**\n * Execute the action and play the sound.\n */\n execute() {\n if (this._sound !== undefined) {\n this._sound.play();\n }\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"PlaySoundAction\",\n properties: [{\n name: \"sound\",\n value: this._sound.name\n }]\n }, parent);\n }\n}\n/**\n * This defines an action helpful to stop a defined sound on a triggered action.\n */\nexport class StopSoundAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param sound defines the sound to stop\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, sound, condition) {\n super(triggerOptions, condition);\n this._sound = sound;\n }\n /** @internal */\n _prepare() {}\n /**\n * Execute the action and stop the sound.\n */\n execute() {\n if (this._sound !== undefined) {\n this._sound.stop();\n }\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"StopSoundAction\",\n properties: [{\n name: \"sound\",\n value: this._sound.name\n }]\n }, parent);\n }\n}\nRegisterClass(\"BABYLON.PlaySoundAction\", PlaySoundAction);\nRegisterClass(\"BABYLON.StopSoundAction\", StopSoundAction);","map":{"version":3,"names":["Action","RegisterClass","PlaySoundAction","constructor","triggerOptions","sound","condition","_sound","_prepare","execute","undefined","play","serialize","parent","_serialize","name","properties","value","StopSoundAction","stop"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Actions/directAudioActions.js"],"sourcesContent":["import { Action } from \"./action.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * This defines an action helpful to play a defined sound on a triggered action.\n */\nexport class PlaySoundAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param sound defines the sound to play\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, sound, condition) {\n super(triggerOptions, condition);\n this._sound = sound;\n }\n /** @internal */\n _prepare() { }\n /**\n * Execute the action and play the sound.\n */\n execute() {\n if (this._sound !== undefined) {\n this._sound.play();\n }\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"PlaySoundAction\",\n properties: [{ name: \"sound\", value: this._sound.name }],\n }, parent);\n }\n}\n/**\n * This defines an action helpful to stop a defined sound on a triggered action.\n */\nexport class StopSoundAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param sound defines the sound to stop\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, sound, condition) {\n super(triggerOptions, condition);\n this._sound = sound;\n }\n /** @internal */\n _prepare() { }\n /**\n * Execute the action and stop the sound.\n */\n execute() {\n if (this._sound !== undefined) {\n this._sound.stop();\n }\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"StopSoundAction\",\n properties: [{ name: \"sound\", value: this._sound.name }],\n }, parent);\n }\n}\nRegisterClass(\"BABYLON.PlaySoundAction\", PlaySoundAction);\nRegisterClass(\"BABYLON.StopSoundAction\", StopSoundAction);\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,aAAa;AACpC,SAASC,aAAa,QAAQ,sBAAsB;AACpD;AACA;AACA;AACA,OAAO,MAAMC,eAAe,SAASF,MAAM,CAAC;EACxC;AACJ;AACA;AACA;AACA;AACA;EACIG,WAAWA,CAACC,cAAc,EAAEC,KAAK,EAAEC,SAAS,EAAE;IAC1C,KA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,CAAC,yBAAyB,EAAEC,eAAe,CAAC;AACzDD,aAAa,CAAC,yBAAyB,EAAEiB,eAAe,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|