online加声音目录
This commit is contained in:
26
boards/default_src/python_pyodide/blocks/sound/play/play.js
Normal file
26
boards/default_src/python_pyodide/blocks/sound/play/play.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
|
||||
export const sound_play = {
|
||||
init: function() {
|
||||
this.setColour('#acc159');
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SOUND_PLAY)
|
||||
.appendField(new Blockly.FieldDropdown(this.getSoundOptions), "SOUND");
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_SOUND_PLAY_TOOLTIP);
|
||||
},
|
||||
|
||||
getSoundOptions: function() {
|
||||
const options = [["Meow", "Meow"], [Blockly.Msg.MIXLY_SOUND_RECORD_OPTION, "record"]];
|
||||
|
||||
if (window.sound && window.sound.builtin) {
|
||||
const recordings = Object.keys(window.sound.builtin).filter(k => k.startsWith('recording'));
|
||||
recordings.forEach(recording => {
|
||||
options.push([recording, recording]);
|
||||
});
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user