@@ -1763,6 +1763,120 @@ export default {
17631763 var code = sbsPrefix + ' get_bot().get_sonar_distance(' + sonar + ' )' ;
17641764 return [code, Blockly .Python .ORDER_ATOMIC ];
17651765 };
1766+
1767+
1768+
1769+
1770+
1771+
1772+
1773+
1774+
1775+
1776+
1777+
1778+
1779+
1780+ Blockly .Blocks [' coderbot_music_note_adv' ] = {
1781+ init : function () {
1782+ this .appendDummyInput ()
1783+ .appendField (" nota" )
1784+ .appendField (new Blockly.FieldDropdown ([[" DO" ," C2" ], [" RE" ," D2" ], [" MI" ," E2" ], [" FA" ," F2" ], [" SOL" ," G2" ], [" LA" ," A2" ], [" SI" ," B2" ], [" DO+" ," C3" ], [" RE+" ," D3" ]]), " note" )
1785+ .appendField (new Blockly.FieldDropdown ([[" nessuna alterazione" ," none" ], [" b" ," bmolle" ], [" #" ," diesis" ]]), " alteration" );
1786+ this .appendValueInput (" instrument" )
1787+ .setCheck (" String" )
1788+ .appendField (" strumento" );
1789+ this .appendValueInput (" duration" )
1790+ .setCheck (" Number" )
1791+ .setAlign (Blockly .ALIGN_CENTRE )
1792+ .appendField (" durata" );
1793+ this .appendDummyInput ()
1794+ .appendField (" secondi" );
1795+ this .setInputsInline (true );
1796+ this .setPreviousStatement (true , null );
1797+ this .setNextStatement (true , null );
1798+ this .setColour (345 );
1799+ this .setTooltip (" " );
1800+ this .setHelpUrl (" " );
1801+ }
1802+ };
1803+
1804+ Blockly .Python [' coderbot_music_note_adv' ] = function (block ) {
1805+ var dropdown_note = block .getFieldValue (' note' );
1806+ var dropdown_alteration = block .getFieldValue (' alteration' );
1807+ var value_instrument = Blockly .Python .valueToCode (block, ' instrument' , Blockly .Python .ORDER_ATOMIC );
1808+
1809+ var value_duration = Blockly .Python .valueToCode (block, ' duration' , Blockly .Python .ORDER_ATOMIC );
1810+
1811+
1812+
1813+ var code = ' get_music().play_note(note="' + dropdown_note+ ' ", alteration="' + dropdown_alteration+ ' " ,instrument=' + value_instrument+ ' ,duration=' + value_duration+ ' )\n ' ;
1814+ return code;
1815+ };
1816+
1817+ Blockly .Blocks [' coderbot_music_instrument_adv' ] = {
1818+ init : function () {
1819+ this .appendDummyInput ()
1820+ .appendField (new Blockly.FieldDropdown ([[" guitar" ," guitar" ], [" piano" ," piano" ], [" flauto" ," flute" ]]), " instrument" );
1821+ this .setInputsInline (true );
1822+ this .setOutput (true , ' String' );
1823+ this .setColour (345 );
1824+ this .setTooltip (" " );
1825+ this .setHelpUrl (" " );
1826+ }
1827+ };
1828+
1829+ Blockly .Python [' coderbot_music_instrument_adv' ] = function (block ) {
1830+ var dropdown_instrument = block .getFieldValue (' instrument' );
1831+ var code = ' "' + dropdown_instrument+ ' "' ;
1832+ return [code, Blockly .Python .ORDER_ATOMIC ];
1833+ };
1834+
1835+ Blockly .Blocks [' coderbot_music_animal_adv' ] = {
1836+ init : function () {
1837+ this .appendDummyInput ()
1838+ .appendField (new Blockly.FieldDropdown ([[" cane" ," dog" ], [" gatto" ," cat" ]]), " instrument" );
1839+ this .setInputsInline (true );
1840+ this .setOutput (true , ' String' );
1841+ this .setColour (345 );
1842+ this .setTooltip (" " );
1843+ this .setHelpUrl (" " );
1844+ }
1845+ };
1846+
1847+ Blockly .Python [' coderbot_music_animal_adv' ] = function (block ) {
1848+ var dropdown_instrument = block .getFieldValue (' instrument' );
1849+ var code = ' "' + dropdown_instrument+ ' "' ;
1850+ return [code, Blockly .Python .ORDER_ATOMIC ];
1851+ };
1852+
1853+ Blockly .Blocks [' coderbot_music_pause_adv' ] = {
1854+ init : function () {
1855+ this .appendDummyInput ()
1856+ .appendField (" pausa" );
1857+ this .appendValueInput (" duration" )
1858+ .setCheck (" Number" )
1859+ .setAlign (Blockly .ALIGN_CENTRE )
1860+ .appendField (" durata" );
1861+ this .appendDummyInput ()
1862+ .appendField (" secondi" );
1863+ this .setInputsInline (true );
1864+ this .setPreviousStatement (true , null );
1865+ this .setNextStatement (true , null );
1866+ this .setColour (345 );
1867+ this .setTooltip (" " );
1868+ this .setHelpUrl (" " );
1869+ }
1870+ };
1871+
1872+ Blockly .Python [' coderbot_music_pause_adv' ] = function (block ) {
1873+ var value_duration = Blockly .Python .valueToCode (block, ' duration' , Blockly .Python .ORDER_ATOMIC );
1874+ var code = ' get_music().play_pause(' + value_duration+ ' )\n ' ;
1875+ return code;
1876+ };
1877+
1878+
1879+
17661880 },
17671881
17681882 toggleSidebar () {
0 commit comments