smalruby-editor 0.2.6-x86-mingw32 → 0.2.7-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of smalruby-editor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/Guardfile +2 -0
- data/app/assets/javascripts/blocks/hardware.js.coffee.erb +1 -1
- data/app/assets/javascripts/fix_blockly.js.erb +0 -50
- data/app/assets/javascripts/generators/ruby.js.coffee.erb +18 -4
- data/app/assets/javascripts/models/source_code.js +1 -1
- data/app/assets/javascripts/msg/en_us.js +1 -0
- data/app/assets/javascripts/msg/ja.js +4 -0
- data/app/assets/javascripts/smalruby.js.coffee.erb +50 -6
- data/app/assets/javascripts/views/main_menu_view.js.coffee.erb +14 -4
- data/app/assets/javascripts/views/preference_modal_view.js.coffee.erb +71 -0
- data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +5 -4
- data/app/assets/stylesheets/application.css +1 -0
- data/app/assets/stylesheets/preference-modal.css.scss +22 -0
- data/app/assets/stylesheets/toolbox.css.scss.erb +36 -0
- data/app/controllers/application_controller.rb +20 -4
- data/app/controllers/editor_controller.rb +4 -0
- data/app/controllers/sessions_controller.rb +7 -4
- data/app/controllers/source_codes_controller.rb +2 -2
- data/app/controllers/users_controller.rb +22 -0
- data/app/helpers/application_helper.rb +4 -4
- data/app/helpers/sessions_helper.rb +0 -0
- data/app/helpers/users_helper.rb +10 -0
- data/app/models/concerns/ruby_to_block/block/hardware_init_hardware.rb +0 -6
- data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +0 -0
- data/app/models/preference.rb +71 -0
- data/app/models/source_code.rb +4 -0
- data/app/models/user.rb +26 -0
- data/app/views/editor/_block_tab.html.haml +5 -6
- data/app/views/editor/_load_modal.html.haml +2 -2
- data/app/views/editor/_preference_modal.html.haml +16 -0
- data/app/views/editor/_signin_modal.html.haml +1 -1
- data/app/views/editor/_toolbox_default.html.haml +86 -79
- data/app/views/editor/{_toolbox_raspberrypi.html.haml → _toolbox_smalrubot.html.haml} +72 -105
- data/app/views/editor/_toolbox_smalrubot_s1.html.haml +1 -196
- data/app/views/editor/_toolbox_smalrubot_v3.html.haml +1 -196
- data/app/views/editor/index.html.haml +11 -4
- data/app/views/editor/toolbox.html.haml +1 -0
- data/app/views/layouts/application.html.erb +1 -1
- data/app/views/users/preferences.html.haml +34 -0
- data/config/application.rb +1 -1
- data/config/locales/en.yml +30 -0
- data/config/locales/ja.yml +30 -0
- data/config/routes.rb +4 -57
- data/db/migrate/20150513061200_create_users.rb +10 -0
- data/db/migrate/20150513061250_add_index_name_on_users.rb +9 -0
- data/db/schema.rb +10 -1
- data/lib/smalruby_editor.rb +22 -24
- data/lib/smalruby_editor/version.rb +1 -1
- data/smalruby-editor.gemspec +0 -0
- data/spec/acceptance/block_mode/blocks/hardware/button_pressed_or_released.feature +2 -0
- data/spec/acceptance/block_mode/blocks/hardware/init_hardware.feature +1 -0
- data/spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature +11 -1
- data/spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature +11 -1
- data/spec/acceptance/block_mode/blocks/hardware/motor_driver.feature +7 -1
- data/spec/acceptance/block_mode/blocks/hardware/motor_driver_speed.feature +2 -0
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature +9 -12
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature +9 -12
- data/spec/acceptance/block_mode/blocks/hardware/sensor_value.feature +59 -60
- data/spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature +76 -67
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature +9 -12
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature +9 -11
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_dc_motor_power_ratio.feature +11 -12
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +9 -10
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature +9 -12
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature +9 -11
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_dc_motor_power_ratio.feature +11 -12
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +9 -12
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_sensor_value.feature +11 -12
- data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car.feature +7 -1
- data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car_speed.feature +2 -0
- data/spec/acceptance/standalone/preference.feature +92 -0
- data/{demos → spec/fixtures/files}/hardware_led.rb.xml +0 -0
- data/spec/javascripts/models/source_code_spec.coffee +0 -0
- data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_spec.rb +1 -1
- data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +4 -4
- data/spec/models/concerns/ruby_to_block_spec.rb +1 -1
- data/spec/models/source_code_spec.rb +1 -11
- data/spec/spec_helper.rb +8 -0
- data/spec/steps/base_steps.rb +68 -16
- data/spec/steps/standalone_steps.rb +21 -0
- data/spec/steps/text_editor_steps.rb +8 -8
- data/spec/support/feature_helper.rb +13 -0
- data/vendor/assets/javascripts/blockly/blockly_compressed.js +500 -454
- data/vendor/assets/javascripts/blockly/blocks_compressed.js +29 -28
- data/vendor/assets/javascripts/blockly/msg/js/ja.js +2 -1
- metadata +33 -35
- data/app/assets/stylesheets/toolbox_default.css.scss.erb +0 -34
- data/app/assets/stylesheets/toolbox_raspberrypi.css.scss.erb +0 -32
- data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +0 -32
- data/app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb +0 -32
- data/demos/adjust_2wd_car.rb.xml +0 -179
- data/lib/smalruby_editor/config.rb +0 -24
- data/spec/controllers/editor_controller_spec.rb +0 -12
- data/spec/controllers/sessions_controller_spec.rb +0 -74
- data/spec/helpers/sessions_helper_spec.rb +0 -15
@@ -46,14 +46,15 @@ b=this.appendStatementInput("ELSE");b.appendField(Blockly.Msg.CONTROLS_IF_MSG_EL
|
|
46
46
|
b++;break;case "controls_if_else":d=this.getInput("ELSE");a.statementConnection_=d&&d.connection.targetConnection;break;default:throw"Unknown block type.";}a=a.nextConnection&&a.nextConnection.targetBlock()}}};Blockly.Blocks.controls_if_if={init:function(){this.setColour(Blockly.Blocks.logic.HUE);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);this.contextMenu=!1}};
|
47
47
|
Blockly.Blocks.controls_if_elseif={init:function(){this.setColour(Blockly.Blocks.logic.HUE);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP);this.contextMenu=!1}};
|
48
48
|
Blockly.Blocks.controls_if_else={init:function(){this.setColour(Blockly.Blocks.logic.HUE);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);this.setPreviousStatement(!0);this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);this.contextMenu=!1}};
|
49
|
-
Blockly.Blocks.logic_compare={init:function(){var a=
|
50
|
-
b.getFieldValue("OP");return{EQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[a]})},onchange:function(){if(this.workspace){var a=this.getInputTargetBlock("A"),b=this.getInputTargetBlock("B");a
|
51
|
-
(a
|
49
|
+
Blockly.Blocks.logic_compare={init:function(){var a=this.RTL?[["=","EQ"],["\u2260","NEQ"],[">","LT"],["\u2265","LTE"],["<","GT"],["\u2264","GTE"]]:[["=","EQ"],["\u2260","NEQ"],["<","LT"],["\u2264","LTE"],[">","GT"],["\u2265","GTE"]];this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL);this.setColour(Blockly.Blocks.logic.HUE);this.setOutput(!0,"Boolean");this.appendValueInput("A");this.appendValueInput("B").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=
|
50
|
+
b.getFieldValue("OP");return{EQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[a]});this.prevBlocks_=[null,null]},onchange:function(){if(this.workspace){var a=this.getInputTargetBlock("A"),b=this.getInputTargetBlock("B");if(a&&b&&!a.outputConnection.checkType_(b.outputConnection))for(var c=0;c<this.prevBlocks_.length;c++){var d=
|
51
|
+
this.prevBlocks_[c];if(d===a||d===b)d.setParent(null),d.bumpNeighbours_()}this.prevBlocks_[0]=a;this.prevBlocks_[1]=b}}};
|
52
52
|
Blockly.Blocks.logic_operation={init:function(){var a=[[Blockly.Msg.LOGIC_OPERATION_AND,"AND"],[Blockly.Msg.LOGIC_OPERATION_OR,"OR"]];this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL);this.setColour(Blockly.Blocks.logic.HUE);this.setOutput(!0,"Boolean");this.appendValueInput("A").setCheck("Boolean");this.appendValueInput("B").setCheck("Boolean").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("OP");return{AND:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND,
|
53
53
|
OR:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR}[a]})}};Blockly.Blocks.logic_negate={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NEGATE_HELPURL);this.setColour(Blockly.Blocks.logic.HUE);this.setOutput(!0,"Boolean");this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE,["BOOL","Boolean",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP)}};
|
54
54
|
Blockly.Blocks.logic_boolean={init:function(){var a=[[Blockly.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[Blockly.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);this.setColour(Blockly.Blocks.logic.HUE);this.setOutput(!0,"Boolean");this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"BOOL");this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP)}};
|
55
55
|
Blockly.Blocks.logic_null={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NULL_HELPURL);this.setColour(Blockly.Blocks.logic.HUE);this.setOutput(!0);this.appendDummyInput().appendField(Blockly.Msg.LOGIC_NULL);this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP)}};
|
56
|
-
Blockly.Blocks.logic_ternary={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_TERNARY_HELPURL);this.setColour(Blockly.Blocks.logic.HUE);this.appendValueInput("IF").setCheck("Boolean").appendField(Blockly.Msg.LOGIC_TERNARY_CONDITION);this.appendValueInput("THEN").appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE);this.appendValueInput("ELSE").appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE);this.setOutput(!0);this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP)}
|
56
|
+
Blockly.Blocks.logic_ternary={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_TERNARY_HELPURL);this.setColour(Blockly.Blocks.logic.HUE);this.appendValueInput("IF").setCheck("Boolean").appendField(Blockly.Msg.LOGIC_TERNARY_CONDITION);this.appendValueInput("THEN").appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE);this.appendValueInput("ELSE").appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE);this.setOutput(!0);this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP);this.prevParentConnection_=null},onchange:function(){if(this.workspace){var a=
|
57
|
+
this.getInputTargetBlock("THEN"),b=this.getInputTargetBlock("ELSE"),c=this.outputConnection.targetConnection;if((a||b)&&c)for(var d=0;2>d;d++){var e=1==d?a:b;e&&!e.outputConnection.checkType_(c)&&(c===this.prevParentConnection_?(this.setParent(null),c.sourceBlock_.bumpNeighbours_()):(e.setParent(null),e.bumpNeighbours_()))}this.prevParentConnection_=c}}};
|
57
58
|
// Copyright 2012 Google Inc. Apache License 2.0
|
58
59
|
Blockly.Blocks.loops={};Blockly.Blocks.loops.HUE=120;
|
59
60
|
Blockly.Blocks.controls_repeat={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_REPEAT_HELPURL);this.setColour(Blockly.Blocks.loops.HUE);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_REPEAT).appendField(new Blockly.FieldTextInput("10",Blockly.FieldTextInput.nonnegativeIntegerValidator),"TIMES").appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_TIMES);this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);this.setPreviousStatement(!0);this.setNextStatement(!0);
|
@@ -90,41 +91,41 @@ Blockly.Blocks.math_random_int={init:function(){this.setHelpUrl(Blockly.Msg.MATH
|
|
90
91
|
Blockly.Blocks.math_random_float={init:function(){this.setHelpUrl(Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL);this.setColour(Blockly.Blocks.math.HUE);this.setOutput(!0,"Number");this.appendDummyInput().appendField(Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM);this.setTooltip(Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP)}};
|
91
92
|
// Copyright 2012 Google Inc. Apache License 2.0
|
92
93
|
Blockly.Blocks.procedures={};Blockly.Blocks.procedures.HUE=290;
|
93
|
-
Blockly.Blocks.procedures_defnoreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);var a=Blockly.Procedures.findLegalName(Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,this);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(
|
94
|
-
this.arguments_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){for(var a=!1,b={},c=0;c<this.arguments_.length;c++){if(b["arg_"+this.arguments_[c].toLowerCase()]){a
|
95
|
-
!0}a?this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING):this.setWarningText(null);a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));this.setFieldValue(a,"PARAMS")},mutationToDom:function(){for(var a=document.createElement("mutation"),b=0;b<this.arguments_.length;b++){var c=document.createElement("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}this.hasStatements_||
|
96
|
-
[];for(var b=0,c;c=a.childNodes[b];b++)"arg"==c.nodeName.toLowerCase()&&this.arguments_.push(c.getAttribute("name"));this.updateParams_();this.setStatements_("false"!==a.getAttribute("statements"))},decompose:function(a){var b=Blockly.Block.obtain(a,"procedures_mutatorcontainer");b.initSvg();this.getInput("RETURN")?b.setFieldValue(this.hasStatements_?"TRUE":"FALSE","STATEMENTS"):b.getInput("STATEMENT_INPUT").setVisible(!1);
|
97
|
-
Blockly.Block.obtain(a,"procedures_mutatorarg");e.initSvg();e.setFieldValue(this.arguments_[d],"NAME");e.oldLocation=d;c.connect(e.previousConnection);c=e.nextConnection}Blockly.Procedures.mutateCallers(this.getFieldValue("NAME"),this.workspace,this.arguments_,null);return b},compose:function(a){this.arguments_=[];this.paramIds_=[];for(var b=a.getInputTargetBlock("STACK");b;)this.arguments_.push(b.getFieldValue("NAME")),
|
98
|
-
this.updateParams_();Blockly.Procedures.mutateCallers(this.getFieldValue("NAME"),this.workspace,this.arguments_,this.paramIds_);a=a.getFieldValue("STATEMENTS");if(null!==a&&(a="TRUE"==a,this.hasStatements_!=a))if(a)this.setStatements_(!0),a=this.getInput("STACK").connection,a.targetConnection||!this.statementConnection_||this.statementConnection_.targetConnection||this.statementConnection_.sourceBlock_.workspace!=this.workspace?
|
99
|
-
this.getInput("STACK").connection;if(this.statementConnection_=a.targetConnection)a=a.targetBlock(),a.setParent(null),a.bumpNeighbours_();this.setStatements_(!1)}},dispose:function(){var a=this.getFieldValue("NAME");Blockly.Procedures.disposeCallers(a,this.workspace);this.constructor.prototype.dispose.apply(this,arguments)},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},
|
100
|
-
this.arguments_[d])&&(this.arguments_[d]=b,c=!0);if(c&&(this.updateParams_(),this.mutator.
|
101
|
-
goog.dom.createDom("arg"),c.setAttribute("name",this.arguments_[e]),d.appendChild(c);d=goog.dom.createDom("block",null,d);d.setAttribute("type",this.callType_);b.callback=Blockly.ContextMenu.callbackFactory(this,d);a.push(b);if(!this.isCollapsed())for(e=0;e<this.arguments_.length;e++)b={enabled:!0},c=this.arguments_[e],b.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c),d=goog.dom.createDom("field",
|
102
|
-
"variables_get"),b.callback=Blockly.ContextMenu.callbackFactory(this,d),a.push(b)},callType_:"procedures_callnoreturn"};
|
103
|
-
Blockly.Blocks.procedures_defreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);var a=Blockly.Procedures.findLegalName(Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE,this);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(
|
94
|
+
Blockly.Blocks.procedures_defnoreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);var a=Blockly.Procedures.findLegalName(Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,this),a=new Blockly.FieldTextInput(a,Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));
|
95
|
+
this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.arguments_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){for(var a=!1,b={},c=0;c<this.arguments_.length;c++){if(b["arg_"+this.arguments_[c].toLowerCase()]){a=
|
96
|
+
!0;break}b["arg_"+this.arguments_[c].toLowerCase()]=!0}a?this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING):this.setWarningText(null);a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));this.setFieldValue(a,"PARAMS")},mutationToDom:function(){for(var a=document.createElement("mutation"),b=0;b<this.arguments_.length;b++){var c=document.createElement("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}this.hasStatements_||
|
97
|
+
a.setAttribute("statements","false");return a},domToMutation:function(a){this.arguments_=[];for(var b=0,c;c=a.childNodes[b];b++)"arg"==c.nodeName.toLowerCase()&&this.arguments_.push(c.getAttribute("name"));this.updateParams_();this.setStatements_("false"!==a.getAttribute("statements"))},decompose:function(a){var b=Blockly.Block.obtain(a,"procedures_mutatorcontainer");b.initSvg();this.getInput("RETURN")?b.setFieldValue(this.hasStatements_?"TRUE":"FALSE","STATEMENTS"):b.getInput("STATEMENT_INPUT").setVisible(!1);
|
98
|
+
for(var c=b.getInput("STACK").connection,d=0;d<this.arguments_.length;d++){var e=Blockly.Block.obtain(a,"procedures_mutatorarg");e.initSvg();e.setFieldValue(this.arguments_[d],"NAME");e.oldLocation=d;c.connect(e.previousConnection);c=e.nextConnection}Blockly.Procedures.mutateCallers(this.getFieldValue("NAME"),this.workspace,this.arguments_,null);return b},compose:function(a){this.arguments_=[];this.paramIds_=[];for(var b=a.getInputTargetBlock("STACK");b;)this.arguments_.push(b.getFieldValue("NAME")),
|
99
|
+
this.paramIds_.push(b.id),b=b.nextConnection&&b.nextConnection.targetBlock();this.updateParams_();Blockly.Procedures.mutateCallers(this.getFieldValue("NAME"),this.workspace,this.arguments_,this.paramIds_);a=a.getFieldValue("STATEMENTS");if(null!==a&&(a="TRUE"==a,this.hasStatements_!=a))if(a)this.setStatements_(!0),a=this.getInput("STACK").connection,a.targetConnection||!this.statementConnection_||this.statementConnection_.targetConnection||this.statementConnection_.sourceBlock_.workspace!=this.workspace?
|
100
|
+
this.statementConnection_=null:a.connect(this.statementConnection_);else{a=this.getInput("STACK").connection;if(this.statementConnection_=a.targetConnection)a=a.targetBlock(),a.setParent(null),a.bumpNeighbours_();this.setStatements_(!1)}},dispose:function(){var a=this.getFieldValue("NAME");Blockly.Procedures.disposeCallers(a,this.workspace);this.constructor.prototype.dispose.apply(this,arguments)},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},
|
101
|
+
renameVar:function(a,b){for(var c=!1,d=0;d<this.arguments_.length;d++)Blockly.Names.equals(a,this.arguments_[d])&&(this.arguments_[d]=b,c=!0);if(c&&(this.updateParams_(),this.mutator.isVisible()))for(var c=this.mutator.workspace_.getAllBlocks(),d=0,e;e=c[d];d++)"procedures_mutatorarg"==e.type&&Blockly.Names.equals(a,e.getFieldValue("NAME"))&&e.setFieldValue(b,"NAME")},customContextMenu:function(a){var b={enabled:!0},c=this.getFieldValue("NAME");b.text=Blockly.Msg.PROCEDURES_CREATE_DO.replace("%1",
|
102
|
+
c);var d=goog.dom.createDom("mutation");d.setAttribute("name",c);for(var e=0;e<this.arguments_.length;e++)c=goog.dom.createDom("arg"),c.setAttribute("name",this.arguments_[e]),d.appendChild(c);d=goog.dom.createDom("block",null,d);d.setAttribute("type",this.callType_);b.callback=Blockly.ContextMenu.callbackFactory(this,d);a.push(b);if(!this.isCollapsed())for(e=0;e<this.arguments_.length;e++)b={enabled:!0},c=this.arguments_[e],b.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c),d=goog.dom.createDom("field",
|
103
|
+
null,c),d.setAttribute("name","VAR"),d=goog.dom.createDom("block",null,d),d.setAttribute("type","variables_get"),b.callback=Blockly.ContextMenu.callbackFactory(this,d),a.push(b)},callType_:"procedures_callnoreturn"};
|
104
|
+
Blockly.Blocks.procedures_defreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);var a=Blockly.Procedures.findLegalName(Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE,this),a=new Blockly.FieldTextInput(a,Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
|
104
105
|
this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.arguments_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:Blockly.Blocks.procedures_defnoreturn.setStatements_,updateParams_:Blockly.Blocks.procedures_defnoreturn.updateParams_,mutationToDom:Blockly.Blocks.procedures_defnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_defnoreturn.domToMutation,decompose:Blockly.Blocks.procedures_defnoreturn.decompose,
|
105
106
|
compose:Blockly.Blocks.procedures_defnoreturn.compose,dispose:Blockly.Blocks.procedures_defnoreturn.dispose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:Blockly.Blocks.procedures_defnoreturn.getVars,renameVar:Blockly.Blocks.procedures_defnoreturn.renameVar,customContextMenu:Blockly.Blocks.procedures_defnoreturn.customContextMenu,callType_:"procedures_callreturn"};
|
106
107
|
Blockly.Blocks.procedures_mutatorcontainer={init:function(){this.setColour(Blockly.Blocks.procedures.HUE);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField(Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new Blockly.FieldCheckbox("TRUE"),"STATEMENTS");this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1}};
|
107
108
|
Blockly.Blocks.procedures_mutatorarg={init:function(){this.setColour(Blockly.Blocks.procedures.HUE);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(new Blockly.FieldTextInput("x",this.validator_),"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1},validator_:function(a){return(a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,""))||null}};
|
108
|
-
Blockly.Blocks.procedures_callnoreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL).appendField("","NAME")
|
109
|
-
|
110
|
-
[]);var c=this.rendered;this.rendered=!1;for(var d=this.arguments_.length-1;0<=d;d--){var e=this.getInput("ARG"+d);if(e){var f=e.connection.targetConnection;this.quarkConnections_[this.quarkArguments_[d]]=f;this.removeInput("ARG"+d)}}this.arguments_=[].concat(a);this.quarkArguments_=b
|
111
|
-
|
112
|
-
c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=a.getAttribute("name");this.setFieldValue(b,"NAME");this.setTooltip((this.outputConnection?Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",
|
113
|
-
this.arguments_.
|
114
|
-
a.push(b)}};
|
115
|
-
Blockly.Blocks.procedures_callreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL).appendField("","NAME")
|
116
|
-
mutationToDom:Blockly.Blocks.procedures_callnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_callnoreturn.domToMutation,renameVar:Blockly.Blocks.procedures_callnoreturn.renameVar,customContextMenu:Blockly.Blocks.procedures_callnoreturn.customContextMenu};
|
109
|
+
Blockly.Blocks.procedures_callnoreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);this.appendDummyInput("TOPROW").appendField(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL).appendField("","NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.arguments_=[];this.quarkConnections_={};this.quarkArguments_=null},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){Blockly.Names.equals(a,
|
110
|
+
this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters:function(a,b){if(b)if(goog.array.equals(this.arguments_,a))this.quarkArguments_=b;else{this.setCollapsed(!1);if(b.length!=a.length)throw"Error: paramNames and paramIds must be the same length.";this.quarkArguments_||(this.quarkConnections_={},a.join("\n")==this.arguments_.join("\n")?
|
111
|
+
this.quarkArguments_=b:this.quarkArguments_=[]);var c=this.rendered;this.rendered=!1;for(var d=this.arguments_.length-1;0<=d;d--){var e=this.getInput("ARG"+d);if(e){var f=e.connection.targetConnection;this.quarkConnections_[this.quarkArguments_[d]]=f;this.removeInput("ARG"+d)}}this.arguments_=[].concat(a);this.renderArgs_();if(this.quarkArguments_=b)for(d=0;d<this.arguments_.length;d++){var e=this.getInput("ARG"+d),g=this.quarkArguments_[d];g in this.quarkConnections_&&(f=this.quarkConnections_[g],
|
112
|
+
!f||f.targetConnection||f.sourceBlock_.workspace!=this.workspace?delete this.quarkConnections_[g]:e.connection.connect(f))}(this.rendered=c)&&this.render()}else this.quarkConnections_={},this.quarkArguments_=null},renderArgs_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.appendValueInput("ARG"+a).setAlign(Blockly.ALIGN_RIGHT).appendField(this.arguments_[a]);b.init()}if(b=this.getInput("TOPROW"))this.arguments_.length?this.getField_("WITH")||(b.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS,
|
113
|
+
"WITH"),b.init()):this.getField_("WITH")&&b.removeField("WITH")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("name",this.getProcedureCall());for(var b=0;b<this.arguments_.length;b++){var c=document.createElement("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=a.getAttribute("name");this.setFieldValue(b,"NAME");this.setTooltip((this.outputConnection?Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",
|
114
|
+
b));if((b=Blockly.Procedures.getDefinition(b,this.workspace))&&b.mutator&&b.mutator.isVisible())this.setProcedureParameters(b.arguments_,b.paramIds_);else{for(var b=[],c=0,d;d=a.childNodes[c];c++)"arg"==d.nodeName.toLowerCase()&&b.push(d.getAttribute("name"));this.setProcedureParameters(b,b)}},renameVar:function(a,b){for(var c=0;c<this.arguments_.length;c++)Blockly.Names.equals(a,this.arguments_[c])&&(this.arguments_[c]=b,this.getInput("ARG"+c).fieldRow[0].setText(b))},customContextMenu:function(a){var b=
|
115
|
+
{enabled:!0};b.text=Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){var a=Blockly.Procedures.getDefinition(c,d);a&&a.select()};a.push(b)}};
|
116
|
+
Blockly.Blocks.procedures_callreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);this.setColour(Blockly.Blocks.procedures.HUE);this.appendDummyInput("TOPROW").appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL).appendField("","NAME");this.setOutput(!0);this.arguments_=[];this.quarkConnections_={};this.quarkArguments_=null},getProcedureCall:Blockly.Blocks.procedures_callnoreturn.getProcedureCall,renameProcedure:Blockly.Blocks.procedures_callnoreturn.renameProcedure,
|
117
|
+
setProcedureParameters:Blockly.Blocks.procedures_callnoreturn.setProcedureParameters,renderArgs_:Blockly.Blocks.procedures_callnoreturn.renderArgs_,mutationToDom:Blockly.Blocks.procedures_callnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_callnoreturn.domToMutation,renameVar:Blockly.Blocks.procedures_callnoreturn.renameVar,customContextMenu:Blockly.Blocks.procedures_callnoreturn.customContextMenu};
|
117
118
|
Blockly.Blocks.procedures_ifreturn={init:function(){this.setHelpUrl("http://c2.com/cgi/wiki?GuardClause");this.setColour(Blockly.Blocks.procedures.HUE);this.appendValueInput("CONDITION").setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP);this.hasReturnValue_=!0},mutationToDom:function(){var a=
|
118
119
|
document.createElement("mutation");a.setAttribute("value",Number(this.hasReturnValue_));return a},domToMutation:function(a){this.hasReturnValue_=1==a.getAttribute("value");this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.workspace){var a=!1,b=this;do{if("procedures_defnoreturn"==b.type||"procedures_defreturn"==b.type){a=!0;break}b=b.getSurroundParent()}while(b);a?("procedures_defnoreturn"==
|
119
120
|
b.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=b.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING)}}};
|
120
121
|
// Copyright 2012 Google Inc. Apache License 2.0
|
121
122
|
Blockly.Blocks.texts={};Blockly.Blocks.texts.HUE=160;
|
122
|
-
Blockly.Blocks.text={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(a){return new Blockly.FieldImage(
|
123
|
+
Blockly.Blocks.text={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(this.newQuote_(!0)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_TEXT_TOOLTIP)},newQuote_:function(a){return new Blockly.FieldImage(a==this.RTL?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",
|
124
|
+
12,12,'"')}};
|
123
125
|
Blockly.Blocks.text_join={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_JOIN_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.itemCount_=2;this.updateShape_();this.setOutput(!0,"String");this.setMutator(new Blockly.Mutator(["text_create_join_item"]));this.setTooltip(Blockly.Msg.TEXT_JOIN_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);
|
124
126
|
this.updateShape_()},decompose:function(a){var b=Blockly.Block.obtain(a,"text_create_join_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=Blockly.Block.obtain(a,"text_create_join_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){a=a.getInputTargetBlock("STACK");for(var b=[],c=0;a;)b[c]=a.valueConnection_,a=a.nextConnection&&a.nextConnection.targetBlock(),c++;this.itemCount_=c;this.updateShape_();for(c=
|
125
|
-
0;c<this.itemCount_;c++)b[c]&&this.getInput("ADD"+c).connection.connect(b[c])},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;b++;a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var a=0;this.getInput("ADD"+a);)this.removeInput("ADD"+a),a++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(
|
126
|
-
|
127
|
-
Blockly.Blocks.text_create_join_container={init:function(){this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP);this.contextMenu=!1}};
|
127
|
+
0;c<this.itemCount_;c++)b[c]&&this.getInput("ADD"+c).connection.connect(b[c])},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;b++;a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){if(this.getInput("EMPTY"))this.removeInput("EMPTY");else for(var a=0;this.getInput("ADD"+a);)this.removeInput("ADD"+a),a++;if(0==this.itemCount_)this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));
|
128
|
+
else for(a=0;a<this.itemCount_;a++){var b=this.appendValueInput("ADD"+a);0==a&&b.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH)}},newQuote_:Blockly.Blocks.text.newQuote_};Blockly.Blocks.text_create_join_container={init:function(){this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP);this.contextMenu=!1}};
|
128
129
|
Blockly.Blocks.text_create_join_item={init:function(){this.setColour(Blockly.Blocks.texts.HUE);this.appendDummyInput().appendField(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP);this.contextMenu=!1}};
|
129
130
|
Blockly.Blocks.text_append={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_APPEND_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendValueInput("TEXT").appendField(Blockly.Msg.TEXT_APPEND_TO).appendField(new Blockly.FieldVariable(Blockly.Msg.TEXT_APPEND_VARIABLE),"VAR").appendField(Blockly.Msg.TEXT_APPEND_APPENDTEXT);this.setPreviousStatement(!0);this.setNextStatement(!0);var a=this;this.setTooltip(function(){return Blockly.Msg.TEXT_APPEND_TOOLTIP.replace("%1",a.getFieldValue("VAR"))})},
|
130
131
|
getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(a,b){Blockly.Names.equals(a,this.getFieldValue("VAR"))&&this.setFieldValue(b,"VAR")}};Blockly.Blocks.text_length={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_LENGTH_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.interpolateMsg(Blockly.Msg.TEXT_LENGTH_TITLE,["VALUE",["String","Array"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setOutput(!0,"Number");this.setTooltip(Blockly.Msg.TEXT_LENGTH_TOOLTIP)}};
|
@@ -76,7 +76,7 @@ Blockly.Msg.EXPAND_BLOCK = "ブロックを展開します。";
|
|
76
76
|
Blockly.Msg.EXTERNAL_INPUTS = "外部入力";
|
77
77
|
Blockly.Msg.HELP = "ヘルプ";
|
78
78
|
Blockly.Msg.INLINE_INPUTS = "インライン入力";
|
79
|
-
Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL = "https://
|
79
|
+
Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-empty-list";
|
80
80
|
Blockly.Msg.LISTS_CREATE_EMPTY_TITLE = "空のリストを作成します。";
|
81
81
|
Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP = "長さゼロ、データ レコード空のリストを返します";
|
82
82
|
Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD = "リスト";
|
@@ -356,6 +356,7 @@ Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH = "両端のスペースを取り除く";
|
|
356
356
|
Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT = "左端のスペースを取り除く";
|
357
357
|
Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT = "右端のスペースを取り除く";
|
358
358
|
Blockly.Msg.TEXT_TRIM_TOOLTIP = "スペースを 1 つまたは両方の端から削除したのち、テキストのコピーを返します。";
|
359
|
+
Blockly.Msg.TODAY = "Today"; // untranslated
|
359
360
|
Blockly.Msg.VARIABLES_DEFAULT_NAME = "項目";
|
360
361
|
Blockly.Msg.VARIABLES_GET_CREATE_SET = "'セット%1を作成します。";
|
361
362
|
Blockly.Msg.VARIABLES_GET_HELPURL = "https://github.com/google/blockly/wiki/Variables#get"; // untranslated
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smalruby-editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Kouji Takao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -293,26 +293,26 @@ files:
|
|
293
293
|
- app/assets/javascripts/views/character_selector_view.js.coffee
|
294
294
|
- app/assets/javascripts/views/load_modal_view.js.coffee.erb
|
295
295
|
- app/assets/javascripts/views/main_menu_view.js.coffee.erb
|
296
|
+
- app/assets/javascripts/views/preference_modal_view.js.coffee.erb
|
296
297
|
- app/assets/javascripts/views/reset_modal_view.js.coffee
|
297
298
|
- app/assets/javascripts/views/signin_modal_view.js.coffee.erb
|
298
299
|
- app/assets/stylesheets/application.css
|
299
300
|
- app/assets/stylesheets/editor.css.scss
|
300
301
|
- app/assets/stylesheets/flatstrap-custom.css.scss
|
301
302
|
- app/assets/stylesheets/load-modal.css.scss
|
303
|
+
- app/assets/stylesheets/preference-modal.css.scss
|
302
304
|
- app/assets/stylesheets/toolbox.css.scss.erb
|
303
|
-
- app/assets/stylesheets/toolbox_default.css.scss.erb
|
304
|
-
- app/assets/stylesheets/toolbox_raspberrypi.css.scss.erb
|
305
|
-
- app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb
|
306
|
-
- app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb
|
307
305
|
- app/assets/templates/.keep
|
308
306
|
- app/controllers/application_controller.rb
|
309
307
|
- app/controllers/concerns/.keep
|
310
308
|
- app/controllers/editor_controller.rb
|
311
309
|
- app/controllers/sessions_controller.rb
|
312
310
|
- app/controllers/source_codes_controller.rb
|
311
|
+
- app/controllers/users_controller.rb
|
313
312
|
- app/helpers/application_helper.rb
|
314
313
|
- app/helpers/editor_helper.rb
|
315
314
|
- app/helpers/sessions_helper.rb
|
315
|
+
- app/helpers/users_helper.rb
|
316
316
|
- app/mailers/.keep
|
317
317
|
- app/models/.keep
|
318
318
|
- app/models/concerns/.keep
|
@@ -398,19 +398,24 @@ files:
|
|
398
398
|
- app/models/concerns/ruby_to_block/block/value.rb
|
399
399
|
- app/models/concerns/ruby_to_block/context.rb
|
400
400
|
- app/models/concerns/ruby_to_block/formatter.rb
|
401
|
+
- app/models/preference.rb
|
401
402
|
- app/models/source_code.rb
|
403
|
+
- app/models/user.rb
|
402
404
|
- app/views/editor/_block_tab.html.haml
|
403
405
|
- app/views/editor/_character_modal.html.haml
|
404
406
|
- app/views/editor/_load_modal.html.haml
|
407
|
+
- app/views/editor/_preference_modal.html.haml
|
405
408
|
- app/views/editor/_reset_modal.html.haml
|
406
409
|
- app/views/editor/_signin_modal.html.haml
|
407
410
|
- app/views/editor/_toolbox_default.html.haml
|
408
|
-
- app/views/editor/
|
411
|
+
- app/views/editor/_toolbox_smalrubot.html.haml
|
409
412
|
- app/views/editor/_toolbox_smalrubot_s1.html.haml
|
410
413
|
- app/views/editor/_toolbox_smalrubot_v3.html.haml
|
411
414
|
- app/views/editor/demo.html.erb
|
412
415
|
- app/views/editor/index.html.haml
|
416
|
+
- app/views/editor/toolbox.html.haml
|
413
417
|
- app/views/layouts/application.html.erb
|
418
|
+
- app/views/users/preferences.html.haml
|
414
419
|
- bin/bundle
|
415
420
|
- bin/rails
|
416
421
|
- bin/rake
|
@@ -443,17 +448,16 @@ files:
|
|
443
448
|
- config/unicorn.rb
|
444
449
|
- db/migrate/20131216121603_create_source_codes.rb
|
445
450
|
- db/migrate/20131219045113_add_filename_to_source_code.rb
|
451
|
+
- db/migrate/20150513061200_create_users.rb
|
452
|
+
- db/migrate/20150513061250_add_index_name_on_users.rb
|
446
453
|
- db/schema.rb
|
447
454
|
- db/seeds.rb
|
448
|
-
- demos/adjust_2wd_car.rb.xml
|
449
455
|
- demos/car_chase.rb.xml
|
450
|
-
- demos/hardware_led.rb.xml
|
451
456
|
- demos/pong.rb.xml
|
452
457
|
- demos/star.rb.xml
|
453
458
|
- lib/assets/.keep
|
454
459
|
- lib/smalruby_editor.rb
|
455
460
|
- lib/smalruby_editor/blockly_message_helper.rb
|
456
|
-
- lib/smalruby_editor/config.rb
|
457
461
|
- lib/smalruby_editor/version.rb
|
458
462
|
- lib/tasks/.keep
|
459
463
|
- lib/tasks/gem.rake
|
@@ -465,14 +469,14 @@ files:
|
|
465
469
|
- public/422.html
|
466
470
|
- public/500.html
|
467
471
|
- public/apple-touch-icon.png
|
468
|
-
- public/assets/application-
|
469
|
-
- public/assets/application-
|
470
|
-
- public/assets/application-
|
471
|
-
- public/assets/application-
|
472
|
+
- public/assets/application-898fef38851604c4b5b18d6afb4f82ef.js
|
473
|
+
- public/assets/application-898fef38851604c4b5b18d6afb4f82ef.js.gz
|
474
|
+
- public/assets/application-f879948b97a781e3d996535a2a0585fa.css
|
475
|
+
- public/assets/application-f879948b97a781e3d996535a2a0585fa.css.gz
|
472
476
|
- public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js
|
473
477
|
- public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js.gz
|
474
|
-
- public/assets/blockly/msg/js/ja-
|
475
|
-
- public/assets/blockly/msg/js/ja-
|
478
|
+
- public/assets/blockly/msg/js/ja-16b694632120c3d1ace214702c6ea413.js
|
479
|
+
- public/assets/blockly/msg/js/ja-16b694632120c3d1ace214702c6ea413.js.gz
|
476
480
|
- public/assets/favicon-d958ba1d3efbea2e9a10fda1b5970b6c.ico
|
477
481
|
- public/assets/jquery-ui/animated-overlay-9b629ab5247187e831ea51106acdf03a.gif
|
478
482
|
- public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-e055bc219bd3aed111713c2ef884d6f4.png
|
@@ -489,20 +493,12 @@ files:
|
|
489
493
|
- public/assets/jquery-ui/ui-icons_888888_256x240-ce584ffa171c3ea9a018cf0d7bec65c8.png
|
490
494
|
- public/assets/jquery-ui/ui-icons_cd0a0a_256x240-747e96029e8dedcabc224e5f7d1f2ede.png
|
491
495
|
- public/assets/loading-e77296be32d066d3e29d3bf9803fa417.gif
|
492
|
-
- public/assets/manifest-
|
493
|
-
- public/assets/msg/en_us-
|
494
|
-
- public/assets/msg/en_us-
|
495
|
-
- public/assets/msg/ja-
|
496
|
-
- public/assets/msg/ja-
|
496
|
+
- public/assets/manifest-86e3c53b834261bf92c8c3a926c0fcf9.json
|
497
|
+
- public/assets/msg/en_us-a98cc83805d44f5f675fe6eac2c955ec.js
|
498
|
+
- public/assets/msg/en_us-a98cc83805d44f5f675fe6eac2c955ec.js.gz
|
499
|
+
- public/assets/msg/ja-243b0a55ef1086ef2180af94c422cb5e.js
|
500
|
+
- public/assets/msg/ja-243b0a55ef1086ef2180af94c422cb5e.js.gz
|
497
501
|
- public/assets/progressbar-ee8fb1222f286f625bbf7332844a6a0c.gif
|
498
|
-
- public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css
|
499
|
-
- public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css.gz
|
500
|
-
- public/assets/toolbox_raspberrypi-c25b8ac975fbc79031ecf87e74027694.css
|
501
|
-
- public/assets/toolbox_raspberrypi-c25b8ac975fbc79031ecf87e74027694.css.gz
|
502
|
-
- public/assets/toolbox_smalrubot_s1-9af26ff13d4496890c4a391f65f95bcd.css
|
503
|
-
- public/assets/toolbox_smalrubot_s1-9af26ff13d4496890c4a391f65f95bcd.css.gz
|
504
|
-
- public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css
|
505
|
-
- public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css.gz
|
506
502
|
- public/blockly/media/1x1.gif
|
507
503
|
- public/blockly/media/anon.jpeg
|
508
504
|
- public/blockly/media/click.mp3
|
@@ -641,11 +637,10 @@ files:
|
|
641
637
|
- spec/acceptance/ruby_mode/download.feature
|
642
638
|
- spec/acceptance/ruby_mode/load.feature
|
643
639
|
- spec/acceptance/ruby_mode/translate.feature
|
640
|
+
- spec/acceptance/standalone/preference.feature
|
644
641
|
- spec/acceptance/standalone/run.feature
|
645
642
|
- spec/acceptance/standalone/save.feature
|
646
643
|
- spec/acceptance/standalone/signin.feature
|
647
|
-
- spec/controllers/editor_controller_spec.rb
|
648
|
-
- spec/controllers/sessions_controller_spec.rb
|
649
644
|
- spec/controllers/source_codes_controller_spec.rb
|
650
645
|
- spec/fixtures/files/01.rb
|
651
646
|
- spec/fixtures/files/01.rb.xml
|
@@ -653,8 +648,8 @@ files:
|
|
653
648
|
- spec/fixtures/files/01_remix02.rb
|
654
649
|
- spec/fixtures/files/01_remix10.rb.xml
|
655
650
|
- spec/fixtures/files/favicon.ico
|
651
|
+
- spec/fixtures/files/hardware_led.rb.xml
|
656
652
|
- spec/helpers/editor_helper_spec.rb
|
657
|
-
- spec/helpers/sessions_helper_spec.rb
|
658
653
|
- spec/javascripts/collections/character_set_spec.coffee
|
659
654
|
- spec/javascripts/models/character_spec.coffee
|
660
655
|
- spec/javascripts/models/scene_spec.coffee
|
@@ -688,9 +683,11 @@ files:
|
|
688
683
|
- spec/steps/block_mode_steps.rb
|
689
684
|
- spec/steps/fix_turnip.rb
|
690
685
|
- spec/steps/global_variable.rb
|
686
|
+
- spec/steps/standalone_steps.rb
|
691
687
|
- spec/steps/text_editor_steps.rb
|
692
688
|
- spec/support/capybara.rb
|
693
689
|
- spec/support/env.rb
|
690
|
+
- spec/support/feature_helper.rb
|
694
691
|
- spec/support/ruby_to_block.rb
|
695
692
|
- spec/teaspoon_env.rb
|
696
693
|
- spec/turnip_helper.rb
|
@@ -818,11 +815,10 @@ test_files:
|
|
818
815
|
- spec/acceptance/ruby_mode/download.feature
|
819
816
|
- spec/acceptance/ruby_mode/load.feature
|
820
817
|
- spec/acceptance/ruby_mode/translate.feature
|
818
|
+
- spec/acceptance/standalone/preference.feature
|
821
819
|
- spec/acceptance/standalone/run.feature
|
822
820
|
- spec/acceptance/standalone/save.feature
|
823
821
|
- spec/acceptance/standalone/signin.feature
|
824
|
-
- spec/controllers/editor_controller_spec.rb
|
825
|
-
- spec/controllers/sessions_controller_spec.rb
|
826
822
|
- spec/controllers/source_codes_controller_spec.rb
|
827
823
|
- spec/fixtures/files/01.rb
|
828
824
|
- spec/fixtures/files/01.rb.xml
|
@@ -830,8 +826,8 @@ test_files:
|
|
830
826
|
- spec/fixtures/files/01_remix02.rb
|
831
827
|
- spec/fixtures/files/01_remix10.rb.xml
|
832
828
|
- spec/fixtures/files/favicon.ico
|
829
|
+
- spec/fixtures/files/hardware_led.rb.xml
|
833
830
|
- spec/helpers/editor_helper_spec.rb
|
834
|
-
- spec/helpers/sessions_helper_spec.rb
|
835
831
|
- spec/javascripts/collections/character_set_spec.coffee
|
836
832
|
- spec/javascripts/models/character_spec.coffee
|
837
833
|
- spec/javascripts/models/scene_spec.coffee
|
@@ -865,9 +861,11 @@ test_files:
|
|
865
861
|
- spec/steps/block_mode_steps.rb
|
866
862
|
- spec/steps/fix_turnip.rb
|
867
863
|
- spec/steps/global_variable.rb
|
864
|
+
- spec/steps/standalone_steps.rb
|
868
865
|
- spec/steps/text_editor_steps.rb
|
869
866
|
- spec/support/capybara.rb
|
870
867
|
- spec/support/env.rb
|
868
|
+
- spec/support/feature_helper.rb
|
871
869
|
- spec/support/ruby_to_block.rb
|
872
870
|
- spec/teaspoon_env.rb
|
873
871
|
- spec/turnip_helper.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
require 'smalruby_editor'
|
3
|
-
colors = SmalrubyEditor::COLORS
|
4
|
-
|
5
|
-
hues = [
|
6
|
-
colors[:motion],
|
7
|
-
colors[:looks],
|
8
|
-
colors[:sound],
|
9
|
-
colors[:pen],
|
10
|
-
colors[:data],
|
11
|
-
colors[:events],
|
12
|
-
colors[:control],
|
13
|
-
colors[:sensing],
|
14
|
-
colors[:operators],
|
15
|
-
colors[:etc],
|
16
|
-
]
|
17
|
-
|
18
|
-
colors = hues.map { |h|
|
19
|
-
[SmalrubyEditor.hsv_to_rgb(h, 100, 80),
|
20
|
-
SmalrubyEditor.hsv_to_rgb(h, 100, 100)]
|
21
|
-
}
|
22
|
-
|
23
|
-
colors.each.with_index(1) do |(color, active_color), index|
|
24
|
-
%>
|
25
|
-
div[aria-level="1"][aria-posinset="<%= index %>"] {
|
26
|
-
.blocklyTreeRow {
|
27
|
-
background-color: #<%= color %> !important;
|
28
|
-
}
|
29
|
-
|
30
|
-
.blocklyTreeRow.blocklyTreeSelected {
|
31
|
-
background-color: #<%= active_color %> !important;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
<% end %>
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
require 'smalruby_editor'
|
3
|
-
colors = SmalrubyEditor::COLORS
|
4
|
-
|
5
|
-
hues = [
|
6
|
-
colors[:motion],
|
7
|
-
colors[:looks],
|
8
|
-
colors[:sound],
|
9
|
-
colors[:data],
|
10
|
-
colors[:events],
|
11
|
-
colors[:control],
|
12
|
-
colors[:sensing],
|
13
|
-
colors[:operators],
|
14
|
-
]
|
15
|
-
|
16
|
-
colors = hues.map { |h|
|
17
|
-
[SmalrubyEditor.hsv_to_rgb(h, 100, 80),
|
18
|
-
SmalrubyEditor.hsv_to_rgb(h, 100, 100)]
|
19
|
-
}
|
20
|
-
|
21
|
-
colors.each.with_index(1) do |(color, active_color), index|
|
22
|
-
%>
|
23
|
-
div[aria-level="1"][aria-posinset="<%= index %>"] {
|
24
|
-
.blocklyTreeRow {
|
25
|
-
background-color: #<%= color %> !important;
|
26
|
-
}
|
27
|
-
|
28
|
-
.blocklyTreeRow.blocklyTreeSelected {
|
29
|
-
background-color: #<%= active_color %> !important;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
<% end %>
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
require 'smalruby_editor'
|
3
|
-
colors = SmalrubyEditor::COLORS
|
4
|
-
|
5
|
-
hues = [
|
6
|
-
colors[:motion],
|
7
|
-
colors[:looks],
|
8
|
-
colors[:data],
|
9
|
-
colors[:events],
|
10
|
-
colors[:control],
|
11
|
-
colors[:sensing],
|
12
|
-
colors[:operators],
|
13
|
-
colors[:etc],
|
14
|
-
]
|
15
|
-
|
16
|
-
colors = hues.map { |h|
|
17
|
-
[SmalrubyEditor.hsv_to_rgb(h, 100, 80),
|
18
|
-
SmalrubyEditor.hsv_to_rgb(h, 100, 100)]
|
19
|
-
}
|
20
|
-
|
21
|
-
colors.each.with_index(1) do |(color, active_color), index|
|
22
|
-
%>
|
23
|
-
div[aria-level="1"][aria-posinset="<%= index %>"] {
|
24
|
-
.blocklyTreeRow {
|
25
|
-
background-color: #<%= color %> !important;
|
26
|
-
}
|
27
|
-
|
28
|
-
.blocklyTreeRow.blocklyTreeSelected {
|
29
|
-
background-color: #<%= active_color %> !important;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
<% end %>
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
require 'smalruby_editor'
|
3
|
-
colors = SmalrubyEditor::COLORS
|
4
|
-
|
5
|
-
hues = [
|
6
|
-
colors[:motion],
|
7
|
-
colors[:looks],
|
8
|
-
colors[:data],
|
9
|
-
colors[:events],
|
10
|
-
colors[:control],
|
11
|
-
colors[:sensing],
|
12
|
-
colors[:operators],
|
13
|
-
colors[:etc],
|
14
|
-
]
|
15
|
-
|
16
|
-
colors = hues.map { |h|
|
17
|
-
[SmalrubyEditor.hsv_to_rgb(h, 100, 80),
|
18
|
-
SmalrubyEditor.hsv_to_rgb(h, 100, 100)]
|
19
|
-
}
|
20
|
-
|
21
|
-
colors.each.with_index(1) do |(color, active_color), index|
|
22
|
-
%>
|
23
|
-
div[aria-level="1"][aria-posinset="<%= index %>"] {
|
24
|
-
.blocklyTreeRow {
|
25
|
-
background-color: #<%= color %> !important;
|
26
|
-
}
|
27
|
-
|
28
|
-
.blocklyTreeRow.blocklyTreeSelected {
|
29
|
-
background-color: #<%= active_color %> !important;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
<% end %>
|
data/demos/adjust_2wd_car.rb.xml
DELETED
@@ -1,179 +0,0 @@
|
|
1
|
-
<xml xmlns="http://www.w3.org/1999/xhtml">
|
2
|
-
<character name="car1" x="170" y="266" costumes="car2.png" angle="241" rotation_style="left_right" />
|
3
|
-
<character name="car2" x="420" y="260" costumes="car2.png" angle="0" rotation_style="left_right" />
|
4
|
-
<character name="frog1" x="276" y="88" costumes="frog1.png" angle="0" />
|
5
|
-
<block type="hardware_init_hardware" x="177" y="30" />
|
6
|
-
<block type="ruby_comment" x="178" y="70">
|
7
|
-
<field name="COMMENT">2WD車の左右のモーターを調整する</field>
|
8
|
-
<next>
|
9
|
-
<block type="character_new">
|
10
|
-
<field name="NAME">frog1</field>
|
11
|
-
<statement name="DO">
|
12
|
-
<block type="events_on_start">
|
13
|
-
<statement name="DO">
|
14
|
-
<block type="looks_say" inline="true">
|
15
|
-
<value name="TEXT">
|
16
|
-
<block type="text">
|
17
|
-
<field name="TEXT">クリックすると前と後ろに動かすよ。←、→で左右のモーターの速度を調整できるよ</field>
|
18
|
-
</block>
|
19
|
-
</value>
|
20
|
-
</block>
|
21
|
-
</statement>
|
22
|
-
<next>
|
23
|
-
<block type="events_on_click">
|
24
|
-
<statement name="DO">
|
25
|
-
<block type="hardware_two_wheel_drive_car_run" inline="true">
|
26
|
-
<field name="PIN">D5</field>
|
27
|
-
<value name="SEC">
|
28
|
-
<block type="math_number">
|
29
|
-
<field name="NUM">2</field>
|
30
|
-
</block>
|
31
|
-
</value>
|
32
|
-
<value name="COMMAND">
|
33
|
-
<block type="hardware_two_wheel_drive_car_commands">
|
34
|
-
<field name="COMMAND">forward</field>
|
35
|
-
</block>
|
36
|
-
</value>
|
37
|
-
<next>
|
38
|
-
<block type="hardware_two_wheel_drive_car_run" inline="true">
|
39
|
-
<field name="PIN">D5</field>
|
40
|
-
<value name="SEC">
|
41
|
-
<block type="math_number">
|
42
|
-
<field name="NUM">2</field>
|
43
|
-
</block>
|
44
|
-
</value>
|
45
|
-
<value name="COMMAND">
|
46
|
-
<block type="hardware_two_wheel_drive_car_commands">
|
47
|
-
<field name="COMMAND">backward</field>
|
48
|
-
</block>
|
49
|
-
</value>
|
50
|
-
</block>
|
51
|
-
</next>
|
52
|
-
</block>
|
53
|
-
</statement>
|
54
|
-
<next>
|
55
|
-
<block type="events_on_key_push_or_down">
|
56
|
-
<field name="KEY">K_LEFT</field>
|
57
|
-
<field name="POD">push</field>
|
58
|
-
<statement name="DO">
|
59
|
-
<block type="hardware_two_wheel_drive_car_set_speed" inline="true">
|
60
|
-
<field name="PIN">D5</field>
|
61
|
-
<field name="LOR">left</field>
|
62
|
-
<value name="SPEED">
|
63
|
-
<block type="operators_minus" inline="true">
|
64
|
-
<value name="A">
|
65
|
-
<block type="hardware_two_wheel_drive_car_speed">
|
66
|
-
<field name="PIN">D5</field>
|
67
|
-
<field name="LOR">left</field>
|
68
|
-
</block>
|
69
|
-
</value>
|
70
|
-
<value name="B">
|
71
|
-
<block type="math_number">
|
72
|
-
<field name="NUM">1</field>
|
73
|
-
</block>
|
74
|
-
</value>
|
75
|
-
</block>
|
76
|
-
</value>
|
77
|
-
<next>
|
78
|
-
<block type="hardware_two_wheel_drive_car_set_speed" inline="true">
|
79
|
-
<field name="PIN">D5</field>
|
80
|
-
<field name="LOR">right</field>
|
81
|
-
<value name="SPEED">
|
82
|
-
<block type="math_number">
|
83
|
-
<field name="NUM">100</field>
|
84
|
-
</block>
|
85
|
-
</value>
|
86
|
-
</block>
|
87
|
-
</next>
|
88
|
-
</block>
|
89
|
-
</statement>
|
90
|
-
<next>
|
91
|
-
<block type="events_on_key_push_or_down">
|
92
|
-
<field name="KEY">K_RIGHT</field>
|
93
|
-
<field name="POD">push</field>
|
94
|
-
<statement name="DO">
|
95
|
-
<block type="hardware_two_wheel_drive_car_set_speed" inline="true">
|
96
|
-
<field name="PIN">D5</field>
|
97
|
-
<field name="LOR">left</field>
|
98
|
-
<value name="SPEED">
|
99
|
-
<block type="math_number">
|
100
|
-
<field name="NUM">100</field>
|
101
|
-
</block>
|
102
|
-
</value>
|
103
|
-
<next>
|
104
|
-
<block type="hardware_two_wheel_drive_car_set_speed" inline="true">
|
105
|
-
<field name="PIN">D5</field>
|
106
|
-
<field name="LOR">right</field>
|
107
|
-
<value name="SPEED">
|
108
|
-
<block type="operators_minus" inline="true">
|
109
|
-
<value name="A">
|
110
|
-
<block type="hardware_two_wheel_drive_car_speed">
|
111
|
-
<field name="PIN">D5</field>
|
112
|
-
<field name="LOR">right</field>
|
113
|
-
</block>
|
114
|
-
</value>
|
115
|
-
<value name="B">
|
116
|
-
<block type="math_number">
|
117
|
-
<field name="NUM">1</field>
|
118
|
-
</block>
|
119
|
-
</value>
|
120
|
-
</block>
|
121
|
-
</value>
|
122
|
-
</block>
|
123
|
-
</next>
|
124
|
-
</block>
|
125
|
-
</statement>
|
126
|
-
</block>
|
127
|
-
</next>
|
128
|
-
</block>
|
129
|
-
</next>
|
130
|
-
</block>
|
131
|
-
</next>
|
132
|
-
</block>
|
133
|
-
</statement>
|
134
|
-
</block>
|
135
|
-
</next>
|
136
|
-
</block>
|
137
|
-
<block type="character_new" x="179" y="617">
|
138
|
-
<field name="NAME">car1</field>
|
139
|
-
<statement name="DO">
|
140
|
-
<block type="events_on_start">
|
141
|
-
<statement name="DO">
|
142
|
-
<block type="control_loop">
|
143
|
-
<statement name="DO">
|
144
|
-
<block type="looks_say" inline="true">
|
145
|
-
<value name="TEXT">
|
146
|
-
<block type="hardware_two_wheel_drive_car_speed">
|
147
|
-
<field name="PIN">D5</field>
|
148
|
-
<field name="LOR">left</field>
|
149
|
-
</block>
|
150
|
-
</value>
|
151
|
-
</block>
|
152
|
-
</statement>
|
153
|
-
</block>
|
154
|
-
</statement>
|
155
|
-
</block>
|
156
|
-
</statement>
|
157
|
-
</block>
|
158
|
-
<block type="character_new" x="588" y="612">
|
159
|
-
<field name="NAME">car2</field>
|
160
|
-
<statement name="DO">
|
161
|
-
<block type="events_on_start">
|
162
|
-
<statement name="DO">
|
163
|
-
<block type="control_loop">
|
164
|
-
<statement name="DO">
|
165
|
-
<block type="looks_say" inline="true">
|
166
|
-
<value name="TEXT">
|
167
|
-
<block type="hardware_two_wheel_drive_car_speed">
|
168
|
-
<field name="PIN">D5</field>
|
169
|
-
<field name="LOR">right</field>
|
170
|
-
</block>
|
171
|
-
</value>
|
172
|
-
</block>
|
173
|
-
</statement>
|
174
|
-
</block>
|
175
|
-
</statement>
|
176
|
-
</block>
|
177
|
-
</statement>
|
178
|
-
</block>
|
179
|
-
</xml>
|