Merge pull request #81 from tmickel/feature/update-playground-june-14

Update playground and block implementations to match scratch-blocks
This commit is contained in:
Tim Mickel 2016-06-17 11:55:44 -04:00 committed by GitHub
commit 28432b6f01
2 changed files with 213 additions and 52 deletions

View file

@ -28,63 +28,224 @@
<div id="blocks"></div> <div id="blocks"></div>
<xml id="toolbox" style="display: none"> <xml id="toolbox" style="display: none">
<category name="Events"> <category name="Events">
<block type="event_whenflagclicked"></block> <block type="event_whenflagclicked"></block>
<block type="event_whenbroadcastreceived"></block> <block type="event_whenbroadcastreceived">
<block type="event_broadcast"></block> <value name="BROADCAST_OPTION">
</category> <shadow type="event_broadcast_menu"></shadow>
<category name="Control">
<block type="control_forever"></block>
<block type="control_repeat">
<value name="TIMES">
<shadow type="math_number">
<field name="NUM">4</field>
</shadow>
</value>
</block>
<block type="control_if"></block>
<block type="control_if_else"></block>
<block type="control_stop"></block>
<block type="control_wait">
<value name="DURATION">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
</category>
<category name="Wedo">
<block type="wedo_setcolor"></block>
<block type="wedo_motorspeed"></block>
<block type="wedo_whentilt"></block>
<block type="wedo_whendistanceclose"></block>
</category>
<category name="Operators">
<block type="math_add">
<value name="NUM1">
<shadow type="math_number">
<field name="NUM">0</field>
</shadow>
</value> </value>
<value name="NUM2"> </block>
<block type="event_broadcast">
<value name="BROADCAST_OPTION">
<shadow type="event_broadcast_menu"></shadow>
</value>
</block>
<block type="event_broadcastandwait">
<value name="BROADCAST_OPTION">
<shadow type="event_broadcast_menu"></shadow>
</value>
</block>
</category>
<category name="Control">
<block type="control_wait">
<value name="DURATION">
<shadow type="math_number"> <shadow type="math_number">
<field name="NUM">0</field> <field name="NUM">1</field>
</shadow> </shadow>
</value> </value>
</block> </block>
<block type="logic_equals"> <block type="control_repeat">
<value name="VALUE1"> <value name="TIMES">
<shadow type="text"> <shadow type="math_number">
<field name="TEXT">0</field> <field name="NUM">4</field>
</shadow>
</value>
<value name="VALUE2">
<shadow type="text">
<field name="TEXT">0</field>
</shadow> </shadow>
</value> </value>
</block> </block>
</category> <block type="control_forever"></block>
<block type="control_if"></block>
<block type="control_if_else"></block>
<block type="control_wait_until"></block>
<block type="control_repeat_until"></block>
<block type="control_stop">
<value name="STOP_OPTION">
<shadow type="control_stop_menu"></shadow>
</value>
</block>
<block type="control_start_as_clone"></block>
<block type="control_create_clone_of">
<value name="CLONE_OPTION">
<shadow type="control_create_clone_of_menu"></shadow>
</value>
</block>
<block type="control_delete_this_clone"></block>
</category>
<category name="Wedo">
<block type="wedo_setcolor"></block>
<block type="wedo_motorspeed"></block>
<block type="wedo_whentilt"></block>
<block type="wedo_whendistanceclose"></block>
</category>
<category name="Operators">
<block type="operator_add">
<value name="NUM1">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
<value name="NUM2">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
</block>
<block type="operator_subtract">
<value name="NUM1">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
<value name="NUM2">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
</block>
<block type="operator_multiply">
<value name="NUM1">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
<value name="NUM2">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
</block>
<block type="operator_divide">
<value name="NUM1">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
<value name="NUM2">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
</block>
<block type="operator_random">
<value name="FROM">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="TO">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
<block type="operator_lt">
<value name="OPERAND1">
<shadow type="text">
<field name="TEXT"></field>
</shadow>
</value>
<value name="OPERAND2">
<shadow type="text">
<field name="TEXT"></field>
</shadow>
</value>
</block>
<block type="operator_equals">
<value name="OPERAND1">
<shadow type="text">
<field name="TEXT"></field>
</shadow>
</value>
<value name="OPERAND2">
<shadow type="text">
<field name="TEXT"></field>
</shadow>
</value>
</block>
<block type="operator_gt">
<value name="OPERAND1">
<shadow type="text">
<field name="TEXT"></field>
</shadow>
</value>
<value name="OPERAND2">
<shadow type="text">
<field name="TEXT"></field>
</shadow>
</value>
</block>
<block type="operator_and"></block>
<block type="operator_or"></block>
<block type="operator_not"></block>
<block type="operator_join">
<value name="STRING1">
<shadow type="text">
<field name="TEXT">hello</field>
</shadow>
</value>
<value name="STRING2">
<shadow type="text">
<field name="TEXT">world</field>
</shadow>
</value>
</block>
<block type="operator_letter_of">
<value name="LETTER">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="STRING">
<shadow type="text">
<field name="TEXT">world</field>
</shadow>
</value>
</block>
<block type="operator_length">
<value name="STRING">
<shadow type="text">
<field name="TEXT">world</field>
</shadow>
</value>
</block>
<block type="operator_mod">
<value name="NUM1">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
<value name="NUM2">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
</block>
<block type="operator_round">
<value name="NUM">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
</block>
<block type="operator_mathop">
<value name="OPERATOR">
<shadow type="operator_mathop_menu"></shadow>
</value>
<value name="NUM">
<shadow type="math_number">
<field name="NUM"></field>
</shadow>
</value>
</block>
</category>
</xml> </xml>
<!-- Syntax highlighter --> <!-- Syntax highlighter -->

View file

@ -14,8 +14,8 @@ Scratch3OperatorsBlocks.prototype.getPrimitives = function() {
return { return {
'math_number': this.number, 'math_number': this.number,
'text': this.text, 'text': this.text,
'math_add': this.add, 'operator_add': this.add,
'logic_equals': this.equals 'operator_equals': this.equals
}; };
}; };
@ -32,7 +32,7 @@ Scratch3OperatorsBlocks.prototype.add = function (args) {
}; };
Scratch3OperatorsBlocks.prototype.equals = function (args) { Scratch3OperatorsBlocks.prototype.equals = function (args) {
return args.VALUE1 == args.VALUE2; return args.OPERAND1 == args.OPERAND2;
}; };
module.exports = Scratch3OperatorsBlocks; module.exports = Scratch3OperatorsBlocks;