mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Add default blocks
This commit is contained in:
parent
6b1184bc28
commit
762f6e7ae2
2 changed files with 46 additions and 7 deletions
|
@ -317,3 +317,16 @@ Blockly.Blocks['argument_reporter_string_number'] = {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Blocks['procedures_mutator_root'] = {
|
||||
/**
|
||||
* Block for calling a procedure with no return value.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function() {
|
||||
this.jsonInit({
|
||||
"extensions": ["colours_more", "shape_statement", "procedure_call_contextmenu"]
|
||||
});
|
||||
this.procCode_ = '';
|
||||
}
|
||||
};
|
||||
|
|
|
@ -65,25 +65,51 @@
|
|||
</xml>
|
||||
|
||||
<xml id="mutator_blocks" style="display:none">
|
||||
<block type="procedures_mutator_root" x="25" y="25" deletable="false">
|
||||
</block>
|
||||
</xml>
|
||||
|
||||
<xml id="main_ws_blocks" style="display:none">
|
||||
<block type="procedure_defnoreturn">
|
||||
|
||||
</block>
|
||||
<block type="procedure_callnoreturn">
|
||||
</block>
|
||||
<block id="]){{Y!7N9ezN+j@Vr`8p" type="procedures_defnoreturn" x="25" y="25">
|
||||
<statement name="custom_block">
|
||||
<shadow type="procedures_callnoreturn_internal">
|
||||
<mutation proccode="say %s %n times if %b" argumentnames="["something","this many","this is true"]" argumentdefaults="["",1,false]" warp="false"/>
|
||||
</shadow>
|
||||
</statement>
|
||||
<next>
|
||||
<block id="tIVT2u+!X}IS8z4nu1x9" type="procedures_callnoreturn">
|
||||
<mutation proccode="say %s %n times if %b"/>
|
||||
<value name="input0">
|
||||
<shadow id="V0~M:TxRk0Ua%osjGzh," type="text">
|
||||
<field name="TEXT"/>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="input1">
|
||||
<shadow id="uPx3si(KkbL1)-XpbXoQ" type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
</next>
|
||||
</block>
|
||||
</xml>
|
||||
|
||||
|
||||
<script>
|
||||
// Inject primary workspace.
|
||||
var primaryWorkspace = Blockly.inject('primaryDiv',
|
||||
{media: '../../media/',
|
||||
toolbox: document.getElementById('toolbox')});
|
||||
{media: '../../media/'});
|
||||
|
||||
Blockly.Xml.domToWorkspace(document.getElementById('mutator_blocks'),
|
||||
primaryWorkspace);
|
||||
|
||||
// Inject secondary workspace.
|
||||
var secondaryWorkspace = Blockly.inject('secondaryDiv',
|
||||
{media: '../../media/',
|
||||
readOnly: true});
|
||||
|
||||
Blockly.Xml.domToWorkspace(document.getElementById('main_ws_blocks'),
|
||||
secondaryWorkspace);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue