smalruby-editor 0.0.12-x86-mingw32 → 0.1.0-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.

Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/.travis.yml +2 -0
  4. data/LEGAL +32 -0
  5. data/Rakefile +1 -1
  6. data/app/assets/demos/default.xml +126 -0
  7. data/app/assets/demos/rgb_led_anode.xml +83 -0
  8. data/app/assets/images/favicon.ico +0 -0
  9. data/app/assets/javascripts/application.js +18 -1
  10. data/app/assets/javascripts/block_mode.js.coffee.erb +10 -0
  11. data/app/assets/javascripts/blocks/blockly.js.coffee.erb +34 -0
  12. data/app/assets/javascripts/blocks/character.js.coffee.erb +76 -0
  13. data/app/assets/javascripts/blocks/control.js.coffee.erb +180 -0
  14. data/app/assets/javascripts/blocks/data.js.coffee.erb +6 -0
  15. data/app/assets/javascripts/blocks/etc.js.coffee.erb +6 -0
  16. data/app/assets/javascripts/blocks/events.js.coffee.erb +82 -0
  17. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +313 -0
  18. data/app/assets/javascripts/blocks/looks.js.coffee.erb +163 -0
  19. data/app/assets/javascripts/blocks/motion.js.coffee.erb +297 -0
  20. data/app/assets/javascripts/blocks/operators.js.coffee.erb +279 -0
  21. data/app/assets/javascripts/blocks/pen.js.coffee.erb +6 -0
  22. data/app/assets/javascripts/blocks/ruby.js.coffee.erb +74 -0
  23. data/app/assets/javascripts/blocks/sensing.js.coffee.erb +241 -0
  24. data/app/assets/javascripts/blocks/sound.js.coffee.erb +75 -0
  25. data/{public/favicon.ico → app/assets/javascripts/collections/.keep} +0 -0
  26. data/app/assets/javascripts/collections/character_set.js.coffee +12 -0
  27. data/app/assets/javascripts/generators/ruby.js.coffee.erb +188 -0
  28. data/app/assets/javascripts/models/.keep +0 -0
  29. data/app/assets/javascripts/models/character.js.coffee +66 -0
  30. data/app/assets/javascripts/models/scene.js.coffee +5 -0
  31. data/app/assets/javascripts/models/source_code.js.coffee +64 -0
  32. data/app/assets/javascripts/routers/.keep +0 -0
  33. data/app/assets/javascripts/ruby_mode.js.coffee.erb +12 -0
  34. data/app/assets/javascripts/smalruby.js.coffee +97 -0
  35. data/app/assets/javascripts/views/.keep +0 -0
  36. data/app/assets/javascripts/views/character_modal_view.js.coffee +148 -0
  37. data/app/assets/javascripts/views/character_selector_view.js.coffee +109 -0
  38. data/app/assets/javascripts/views/main_menu_view.js.coffee +264 -0
  39. data/app/assets/stylesheets/editor.css.scss +318 -2
  40. data/app/assets/stylesheets/toolbox.css.scss.erb +62 -0
  41. data/app/assets/templates/.keep +0 -0
  42. data/app/controllers/application_controller.rb +19 -0
  43. data/app/controllers/editor_controller.rb +4 -0
  44. data/app/controllers/source_codes_controller.rb +8 -2
  45. data/app/helpers/application_helper.rb +1 -0
  46. data/app/helpers/editor_helper.rb +46 -0
  47. data/app/models/source_code.rb +49 -6
  48. data/app/views/editor/_block_tab.html.haml +53 -0
  49. data/app/views/editor/_character_modal.html.haml +53 -0
  50. data/app/views/editor/_toolbox.html.haml +384 -0
  51. data/app/views/editor/demo.html.erb +16 -0
  52. data/app/views/editor/index.html.haml +60 -0
  53. data/app/views/layouts/application.html.erb +7 -0
  54. data/config/application.rb +1 -0
  55. data/config/initializers/teaspoon.rb +79 -0
  56. data/config/routes.rb +4 -0
  57. data/lib/smalruby_editor/version.rb +1 -1
  58. data/lib/tasks/gem.rake +7 -4
  59. data/lib/tasks/release.rake +43 -0
  60. data/public/apple-touch-icon.png +0 -0
  61. data/public/blockly/media/1x1.gif +0 -0
  62. data/public/blockly/media/click.mp3 +0 -0
  63. data/public/blockly/media/click.ogg +0 -0
  64. data/public/blockly/media/click.wav +0 -0
  65. data/public/blockly/media/delete.mp3 +0 -0
  66. data/public/blockly/media/delete.ogg +0 -0
  67. data/public/blockly/media/delete.wav +0 -0
  68. data/public/blockly/media/handclosed.cur +0 -0
  69. data/public/blockly/media/handopen.cur +0 -0
  70. data/public/blockly/media/quote0.png +0 -0
  71. data/public/blockly/media/quote1.png +0 -0
  72. data/public/blockly/media/trashbody.png +0 -0
  73. data/public/blockly/media/trashlid.png +0 -0
  74. data/public/blockly/media/tree.png +0 -0
  75. data/public/browserconfig.xml +1 -0
  76. data/public/large.png +0 -0
  77. data/public/smalruby/assets/ball1.png +0 -0
  78. data/public/smalruby/assets/ball2.png +0 -0
  79. data/public/smalruby/assets/ball3.png +0 -0
  80. data/public/smalruby/assets/ball4.png +0 -0
  81. data/public/smalruby/assets/ball5.png +0 -0
  82. data/public/smalruby/assets/ball6.png +0 -0
  83. data/public/smalruby/assets/car1.png +0 -0
  84. data/public/smalruby/assets/car2.png +0 -0
  85. data/public/smalruby/assets/car3.png +0 -0
  86. data/public/smalruby/assets/car4.png +0 -0
  87. data/public/smalruby/assets/cat1.png +0 -0
  88. data/public/smalruby/assets/cat2.png +0 -0
  89. data/public/smalruby/assets/cat3.png +0 -0
  90. data/public/smalruby/assets/frog1.png +0 -0
  91. data/public/smalruby/assets/piano_do.wav +0 -0
  92. data/public/smalruby/assets/piano_do_2.wav +0 -0
  93. data/public/smalruby/assets/piano_fa.wav +0 -0
  94. data/public/smalruby/assets/piano_mi.wav +0 -0
  95. data/public/smalruby/assets/piano_ra.wav +0 -0
  96. data/public/smalruby/assets/piano_re.wav +0 -0
  97. data/public/smalruby/assets/piano_si.wav +0 -0
  98. data/public/smalruby/assets/piano_so.wav +0 -0
  99. data/public/square.png +0 -0
  100. data/public/tiny.png +0 -0
  101. data/public/wide.png +0 -0
  102. data/smalruby-editor.gemspec +4 -0
  103. data/spec/acceptance/block_mode/blocks/character/new.feature +136 -0
  104. data/spec/acceptance/block_mode/blocks/control/await.feature +20 -0
  105. data/spec/acceptance/block_mode/blocks/control/await_until.feature +39 -0
  106. data/spec/acceptance/block_mode/blocks/control/break.feature +20 -0
  107. data/spec/acceptance/block_mode/blocks/control/if.feature +68 -0
  108. data/spec/acceptance/block_mode/blocks/control/if_else.feature +78 -0
  109. data/spec/acceptance/block_mode/blocks/control/loop.feature +45 -0
  110. data/spec/acceptance/block_mode/blocks/control/next.feature +20 -0
  111. data/spec/acceptance/block_mode/blocks/control/redo.feature +20 -0
  112. data/spec/acceptance/block_mode/blocks/control/sleep.feature +41 -0
  113. data/spec/acceptance/block_mode/blocks/control/times.feature +72 -0
  114. data/spec/acceptance/block_mode/blocks/control/until.feature +68 -0
  115. data/spec/acceptance/block_mode/blocks/events/on_click.feature +75 -0
  116. data/spec/acceptance/block_mode/blocks/events/on_hit.feature +83 -0
  117. data/spec/acceptance/block_mode/blocks/events/on_key_push_or_down.feature +171 -0
  118. data/spec/acceptance/block_mode/blocks/events/on_start.feature +75 -0
  119. data/spec/acceptance/block_mode/blocks/hardware/init_hardware.feature +44 -0
  120. data/spec/acceptance/block_mode/blocks/hardware/led_off.feature +75 -0
  121. data/spec/acceptance/block_mode/blocks/hardware/led_on.feature +75 -0
  122. data/spec/acceptance/block_mode/blocks/hardware/on_sensor_change.feature +81 -0
  123. data/spec/acceptance/block_mode/blocks/hardware/rgb_led_off.feature +81 -0
  124. data/spec/acceptance/block_mode/blocks/hardware/rgb_led_on.feature +87 -0
  125. data/spec/acceptance/block_mode/blocks/hardware/sensor_value.feature +100 -0
  126. data/spec/acceptance/block_mode/blocks/looks/hide.feature +69 -0
  127. data/spec/acceptance/block_mode/blocks/looks/say.feature +106 -0
  128. data/spec/acceptance/block_mode/blocks/looks/show.feature +69 -0
  129. data/spec/acceptance/block_mode/blocks/looks/vanish.feature +69 -0
  130. data/spec/acceptance/block_mode/blocks/motion/change_x_by.feature +81 -0
  131. data/spec/acceptance/block_mode/blocks/motion/change_y_by.feature +81 -0
  132. data/spec/acceptance/block_mode/blocks/motion/move.feature +81 -0
  133. data/spec/acceptance/block_mode/blocks/motion/reach_wall.feature +98 -0
  134. data/spec/acceptance/block_mode/blocks/motion/rotate_left.feature +81 -0
  135. data/spec/acceptance/block_mode/blocks/motion/rotate_right.feature +81 -0
  136. data/spec/acceptance/block_mode/blocks/motion/self_angle.feature +92 -0
  137. data/spec/acceptance/block_mode/blocks/motion/self_x.feature +92 -0
  138. data/spec/acceptance/block_mode/blocks/motion/self_y.feature +92 -0
  139. data/spec/acceptance/block_mode/blocks/motion/set_angle.feature +81 -0
  140. data/spec/acceptance/block_mode/blocks/motion/set_x.feature +81 -0
  141. data/spec/acceptance/block_mode/blocks/motion/set_x_y.feature +95 -0
  142. data/spec/acceptance/block_mode/blocks/motion/set_y.feature +81 -0
  143. data/spec/acceptance/block_mode/blocks/motion/turn.feature +69 -0
  144. data/spec/acceptance/block_mode/blocks/motion/turn_if_reach_wall.feature +69 -0
  145. data/spec/acceptance/block_mode/blocks/sensing/character_property.feature +114 -0
  146. data/spec/acceptance/block_mode/blocks/sensing/hit.feature +110 -0
  147. data/spec/acceptance/block_mode/blocks/sensing/input_key_push_or_down.feature +91 -0
  148. data/spec/acceptance/block_mode/blocks/sensing/input_mouse_pos_x.feature +39 -0
  149. data/spec/acceptance/block_mode/blocks/sensing/input_mouse_pos_y.feature +39 -0
  150. data/spec/acceptance/block_mode/blocks/sensing/input_mouse_push_or_down.feature +91 -0
  151. data/spec/acceptance/block_mode/blocks/sensing/time_now.feature +43 -0
  152. data/spec/acceptance/block_mode/blocks/sound/play.feature +81 -0
  153. data/spec/acceptance/block_mode/demo.feature +49 -0
  154. data/spec/acceptance/{text_editor → ruby_mode}/base.feature +11 -2
  155. data/spec/acceptance/{standalone → ruby_mode}/check.feature +8 -9
  156. data/spec/acceptance/ruby_mode/download.feature +33 -0
  157. data/spec/acceptance/{text_editor → ruby_mode}/load.feature +13 -13
  158. data/spec/acceptance/standalone/run.feature +17 -0
  159. data/spec/acceptance/standalone/save.feature +6 -6
  160. data/spec/helpers/editor_helper_spec.rb +110 -10
  161. data/spec/javascripts/collections/character_set_spec.coffee +41 -0
  162. data/spec/javascripts/models/character_spec.coffee +146 -0
  163. data/spec/javascripts/models/scene_spec.coffee +15 -0
  164. data/spec/javascripts/spec_helper.js +29 -0
  165. data/spec/spec_helper.rb +3 -8
  166. data/spec/steps/block_mode_steps.rb +37 -0
  167. data/spec/steps/global_variable.rb +30 -6
  168. data/spec/steps/text_editor_steps.rb +20 -2
  169. data/spec/teaspoon_env.rb +46 -0
  170. data/vendor/assets/javascripts/blockly/blockly_compressed.js +992 -0
  171. data/vendor/assets/javascripts/blockly/blocks_compressed.js +129 -0
  172. data/vendor/assets/javascripts/blockly/msg/js/ja.js +377 -0
  173. data/vendor/assets/javascripts/jquery.blockUI.js +619 -0
  174. metadata +290 -23
  175. data/app/assets/javascripts/editor.js.coffee.erb +0 -137
  176. data/app/views/editor/index.html.erb +0 -22
  177. data/spec/acceptance/text_editor/check.feature +0 -29
  178. data/spec/acceptance/text_editor/save.feature +0 -34
  179. data/spec/support/assets.rb +0 -18
@@ -1,2 +1,3 @@
1
+ # -*- coding: utf-8 -*-
1
2
  module ApplicationHelper
2
3
  end
@@ -1,2 +1,48 @@
1
+ # -*- coding: utf-8 -*-
1
2
  module EditorHelper
3
+ # ツールボックスのブロックに対して、キャラクターの入力フィールドの値を設定する
4
+ #
5
+ # @param [String] name 名前
6
+ # @return [String] XML
7
+ def toolbox_character_field(name = 'VAR')
8
+ %(<field name="#{h name}">char1</field>).html_safe
9
+ end
10
+
11
+ # ツールボックスのブロックに対して、キーの入力フィールドの値を設定する
12
+ #
13
+ # @param [String] name 名前
14
+ # @param [String] value キーの名前。K_SPACE、K_Aなど
15
+ # @return [String] XML
16
+ def toolbox_key_field(name = 'KEY', value = 'K_SPACE')
17
+ %(<field name="#{h name}">#{h value}</field>).html_safe
18
+ end
19
+ # ツールボックスのブロックに対して、数値型の入力のブロックを設定する
20
+ #
21
+ # @param [String] name 入力値の名前
22
+ # @param [Numeric] value 数値
23
+ # @return [String] XML
24
+ def toolbox_number_value(name, value = 0)
25
+ <<-XML.strip_heredoc.html_safe
26
+ <value name="#{h name}">
27
+ <block type="math_number">
28
+ <field name="NUM">#{h value.to_i}</field>
29
+ </block>
30
+ </value>
31
+ XML
32
+ end
33
+
34
+ # ツールボックスのブロックに対して、テキスト型の入力のブロックを設定する
35
+ #
36
+ # @param [String] name 入力値の名前
37
+ # @param [String] value 文字列
38
+ # @return [String] XML
39
+ def toolbox_text_value(name = 'TEXT', value = '')
40
+ <<-XML.strip_heredoc.html_safe
41
+ <value name="#{h name}">
42
+ <block type="text">
43
+ <field name="TEXT">#{h value}</field>
44
+ </block>
45
+ </value>
46
+ XML
47
+ end
2
48
  end
@@ -3,6 +3,7 @@
3
3
  require 'tempfile'
4
4
  require 'open3'
5
5
  require 'digest/sha2'
6
+ require 'bundler'
6
7
 
7
8
  # ソースコードを表現するモデル
8
9
  class SourceCode < ActiveRecord::Base
@@ -24,6 +25,14 @@ class SourceCode < ActiveRecord::Base
24
25
  }
25
26
  end
26
27
 
28
+ # プログラムを実行する
29
+ def run(path)
30
+ _, stderr_str, status = *open3_capture3_run_program(path)
31
+ return [] if status.success?
32
+
33
+ parse_ruby_error_messages(stderr_str)
34
+ end
35
+
27
36
  # ハッシュ値を計算する
28
37
  def digest
29
38
  Digest::SHA256.hexdigest(data)
@@ -31,19 +40,53 @@ class SourceCode < ActiveRecord::Base
31
40
 
32
41
  private
33
42
 
43
+ def validate_filename
44
+ if File.basename(filename) != filename
45
+ errors.add(:filename, 'includes directory separator(s)')
46
+ end
47
+ end
48
+
49
+ def ruby_cmd
50
+ path = Pathname('rsdl').expand_path(RbConfig::CONFIG['bindir'])
51
+ if path.exist?
52
+ path
53
+ else
54
+ Pathname(RbConfig::CONFIG['RUBY_INSTALL_NAME'])
55
+ .expand_path(RbConfig::CONFIG['bindir'])
56
+ end
57
+ end
58
+
34
59
  def open3_capture3_ruby_c
35
60
  tempfile = Tempfile.new('smalruby-editor')
36
61
  tempfile.write(data)
37
62
  path = tempfile.path
38
63
  tempfile.close
39
- ruby_cmd = File.join(RbConfig::CONFIG['bindir'],
40
- RbConfig::CONFIG['RUBY_INSTALL_NAME'])
41
- Open3.capture3("#{ruby_cmd} -c #{path}")
64
+
65
+ Bundler.with_clean_env do
66
+ Open3.capture3("#{ruby_cmd} -c #{path}")
67
+ end
42
68
  end
43
69
 
44
- def validate_filename
45
- if File.basename(filename) != filename
46
- errors.add(:filename, 'includes directory separator(s)')
70
+ def open3_capture3_run_program(path)
71
+ Bundler.with_clean_env do
72
+ Open3.capture3("#{ruby_cmd} #{path}")
47
73
  end
48
74
  end
75
+
76
+ # rubocop:disable MethodLength
77
+ def parse_ruby_error_messages(stderr_str)
78
+ stderr_str.lines.each.with_object([]) { |line, res|
79
+ if (md = /^\tfrom .*:(\d+):(in .*)$/.match(line))
80
+ res << { row: md[1].to_i, column: 0, message: md[2] }
81
+ elsif (md = /^.*:(\d+):(in .*)$/.match(line))
82
+ res << { row: md[1].to_i, column: 0, message: md[2] }
83
+ elsif (md = /( +)\^$/.match(line))
84
+ res[-1][:column] = md[1].length
85
+ else
86
+ row = res[-1] ? res[-1][:row] : 0
87
+ res << { row: row, column: 0, message: line.chomp }
88
+ end
89
+ }
90
+ end
91
+ # rubocop:enable MethodLength
49
92
  end
@@ -0,0 +1,53 @@
1
+ #block-tab-right-pane{:class => 'right-pane'}
2
+ #blockly-div
3
+
4
+ = render 'toolbox'
5
+
6
+ #block-tab-left-pane{:class => 'left-pane'}
7
+ #selectors-container
8
+ %ul.nav{:class => 'nav-pills'}
9
+ %li.active
10
+ %a{:href => '#character-selector-tab', :'data-toggle' => 'tab'}<
11
+ キャラクター
12
+ -#%li
13
+ -#%a{:href => '#scene-selector-tab', :'data-toggle' => 'tab'}<
14
+ -#ステージ
15
+
16
+ #selectors-tab-content{:class => 'tab-content'}
17
+ #character-selector-tab{:class => 'tab-pane active selector-tab'}
18
+ #character-selector-character-set
19
+ .item
20
+ %a#add-character-button{:class => 'character'}
21
+ %i.icon-plus-sign-alt
22
+ %br
23
+ 新しいキャラクター
24
+
25
+ #scene-selector-tab{:class => 'tab-pane selector-tab'}
26
+ .item
27
+ %a{:href => '#', :onclick => 'window.event.preventDefault();'}
28
+ %div
29
+ .item
30
+ %a{:href => '#', :onclick => 'window.event.preventDefault();'}
31
+ %div
32
+
33
+ = render 'character_modal'
34
+
35
+ %script#character-selector-template{:type => 'text/template'}
36
+ .item
37
+ .item-info
38
+ .name
39
+ {{- get('name') }}
40
+ .attributes
41
+ X: {{- get('x') }} Y: {{- get('y') }}
42
+ %br
43
+ 向き: {{- get('angle') }}°
44
+
45
+ %a.add-block-button
46
+ %i.icon-folder-close-alt
47
+ %i.icon-double-angle-right
48
+
49
+ %a.remove-button
50
+ %i.icon-remove
51
+
52
+ %a.character
53
+ %img{:src => '{{- costumeUrl() }}'}
@@ -0,0 +1,53 @@
1
+ #character-modal{:class => 'modal hide fade', :tabindex => '-1',
2
+ :role => 'dialog', :'aria-hidden' => 'true'}
3
+ .modal-body
4
+ #character-modal-right-pane{:class => 'right-pane'}
5
+ #character-modal-costume-selector
6
+ .row-fluid
7
+ %ul.thumbnails
8
+ - %w(car1 car2 car3 car4 cat1 cat2 cat3 frog1 ball1 ball2 ball3 ball4 ball5 ball6).each do |name|
9
+ %li
10
+ %a.thumbnail
11
+ %img{:src => "/smalruby/assets/#{name}.png", :alt => "#{name}.png"}
12
+
13
+ #character-modal-left-pane{:class => 'left-pane'}
14
+ #character-modal-preview
15
+ #character-modal-character
16
+ %img{:src => "/smalruby/assets/car1.png"}
17
+
18
+ #character-modal-attributes
19
+ %form#character-modal-form{:class => 'form-horizontal'}
20
+ .control-group
21
+ %label.control-label{:for => 'character_name'}<
22
+ 名前
23
+ .controls
24
+ %input#character_name{:name => 'character[name]', :type => 'text', :placeholder => 'car1やball1など', :class => 'input-medium'}
25
+ .control-group
26
+ %label.control-label{:for => 'character_x'}<
27
+ X座標
28
+ .controls
29
+ %input#character_x{:name => 'character[x]', :type => 'range', :min => '0', :max => '639', :class => 'input-medium'}
30
+ %span#character_x_value{:class => 'character_value'}
31
+ 300
32
+ .control-group
33
+ %label.control-label{:for => 'character_y'}<
34
+ Y座標
35
+ .controls
36
+ %input#character_y{:name => 'character[y]', :type => 'range', :min => '0', :max => '439', :class => 'input-medium'}
37
+ %span#character_y_value{:class => 'character_value'}
38
+ 200
39
+ .control-group
40
+ %label.control-label{:for => 'character_angle'}<
41
+ 向き
42
+ .controls
43
+ %input#character_angle{:name => 'character[angle]', :type => 'range', :min => '0', :max => '359', :class => 'input-medium'}
44
+ %span#character_angle_value{:class => 'character_value'}
45
+ 100°
46
+
47
+ .modal-footer
48
+ %button.btn{:'data-dismiss' => 'modal', :'aria-hidden' => 'true'}<
49
+ %i.icon-remove
50
+ やめる
51
+ %button#character-modal-ok-button{:class => 'btn btn-primary'}<
52
+ %i.icon-circle-blank
53
+ 決めた!
@@ -0,0 +1,384 @@
1
+ %xml{:id => 'toolbox', :style => 'display: none'}
2
+ - category = 'motion'
3
+ %category{:name => '動き'}
4
+ -# ( )歩動かす
5
+ %block{:type => "#{category}_move"}
6
+ = toolbox_number_value('STEP', 10)
7
+
8
+ -# 時計回りに( )度回す
9
+ %block{:type => "#{category}_rotate_right"}
10
+ = toolbox_number_value('ANGLE', 15)
11
+
12
+ -# 半時計回りに( )度回す
13
+ %block{:type => "#{category}_rotate_left"}
14
+ = toolbox_number_value('ANGLE', 15)
15
+
16
+ -# ( )度に向ける
17
+ %block{:type => "#{category}_set_angle"}
18
+ = toolbox_number_value('ANGLE', 90)
19
+
20
+ -# マウスポインターへ向ける
21
+ %block{:type => "#{category}_point_towards_mouse"}
22
+
23
+ -# [▼]へ向ける
24
+ %block{:type => "#{category}_point_towards_character"}
25
+ = toolbox_character_field
26
+
27
+ -# x座標を( )、y座標を( )にする
28
+ %block{:type => "#{category}_set_x_y"}
29
+ = toolbox_number_value('X')
30
+ = toolbox_number_value('Y')
31
+
32
+ -# マウスポインターへ行く
33
+ -#%block{:type => "#{category}_go_to_mouse"}
34
+
35
+ -# [▼]へ行く
36
+ -#%block{:type => "#{category}_go_to_character"}
37
+
38
+ -# ( )秒でx座標を( )、y座標を( )に変える
39
+ -#%block{:type => "#{category}_glide_to_x_y"}
40
+ -# = toolbox_number_value('SEC', 1)
41
+ -# = toolbox_number_value('X')
42
+ -# = toolbox_number_value('Y')
43
+
44
+ -# x座標を( )ずつ変える
45
+ %block{:type => "#{category}_change_x_by"}
46
+ = toolbox_number_value('X', 10)
47
+
48
+ -# x座標を( )にする
49
+ %block{:type => "#{category}_set_x"}
50
+ = toolbox_number_value('X', 0)
51
+
52
+ -# y座標を( )ずつ変える
53
+ %block{:type => "#{category}_change_y_by"}
54
+ = toolbox_number_value('Y', 10)
55
+
56
+ -# y座標を( )にする
57
+ %block{:type => "#{category}_set_y"}
58
+ = toolbox_number_value('Y', 0)
59
+
60
+ -# もし端に着いたら、跳ね返る
61
+ %block{:type => "#{category}_turn_if_reach_wall"}
62
+
63
+ -# 条件:端に着いた
64
+ %block{:type => "#{category}_reach_wall"}
65
+
66
+ -# 跳ね返る
67
+ %block{:type => "#{category}_turn"}
68
+
69
+ -# 回転方法を[▼]にする
70
+ -#%block{:type => "#{category}_set_rotation_style"}
71
+
72
+ -# 変数:x座標
73
+ %block{:type => "#{category}_self_x"}
74
+
75
+ -# 変数:y座標
76
+ %block{:type => "#{category}_self_y"}
77
+
78
+ -# 変数:向き
79
+ %block{:type => "#{category}_self_angle"}
80
+
81
+ - category = 'looks'
82
+ %category{:name => '見た目'}
83
+ -# [ ]と( )秒言う
84
+ -#%block{:type => "#{category}_say_second"}
85
+ -# = toolbox_text_value('TEXT', 'こんにちは!')
86
+ -# = toolbox_number_value('SEC', 2)
87
+
88
+ -# [ ]と言う
89
+ %block{:type => "#{category}_say"}
90
+ = toolbox_text_value('TEXT', 'こんにちは!')
91
+
92
+ -# [ ]と( )秒考える
93
+ -#%block{:type => "#{category}_think_second"}
94
+ -# = toolbox_text_value('TEXT', 'ふーん')
95
+ -# = toolbox_number_value('SEC', 2)
96
+
97
+ -# [ ]と考える
98
+ -#%block{:type => "#{category}_think"}
99
+ -# = toolbox_text_value('TEXT', 'ふーん')
100
+
101
+ -# 表示する
102
+ %block{:type => "#{category}_show"}
103
+
104
+ -# 隠す
105
+ %block{:type => "#{category}_hide"}
106
+
107
+ -# 消滅する
108
+ %block{:type => "#{category}_vanish"}
109
+
110
+ -# 大きさを( )%ずつ変える
111
+ -#%block{:type => "#{category}_change_scale_by"}
112
+ -# = toolbox_number_value('SCALE', 10)
113
+
114
+ -# 大きさを( )%にする
115
+ -#%block{:type => "#{category}_set_scale"}
116
+ -# = toolbox_number_value('SCALE', 100)
117
+
118
+ -# 変数:大きさ
119
+ -#%block{:type => "#{category}_self_scale"}
120
+
121
+ -# [▼プリセット画像]
122
+ -#%block{:type => "#{category}_preset_images"}
123
+
124
+ - category = 'sound'
125
+ %category{:name => '音'}
126
+ -# [▼プリセット音声]の音を鳴らす
127
+ %block{:type => "#{category}_play"}
128
+ %value{:name => 'NAME'}
129
+ %block{:type => "#{category}_preset_sounds"}
130
+
131
+ -# すべての音を止める
132
+ -#%block{:type => "#{category}_stop"}
133
+
134
+ -# 変数:ボリューム
135
+ -#%block{:type => "#{category}_volume"}
136
+
137
+ - category = 'events'
138
+ %category{:name => '~のとき'}
139
+ -# まずは
140
+ %block{:type => "#{category}_on_start"}
141
+
142
+ -# キーボードの[▼キー]が[▼押された/押され続けている]とき
143
+ %block{:type => "#{category}_on_key_push_or_down"}
144
+ = toolbox_key_field
145
+
146
+ -# キャラクターがクリックされたとき
147
+ %block{:type => "#{category}_on_click"}
148
+
149
+ -# [▼キャラクター]にぶつかったとき
150
+ %block{:type => "#{category}_on_hit"}
151
+
152
+ - category = 'control'
153
+ %category{:name => '繰り返し'}
154
+ -# ずっと
155
+ %block{:type => "#{category}_loop"}
156
+
157
+ -# ( )回繰り返す
158
+ %block{:type => "#{category}_times"}
159
+ = toolbox_number_value('COUNT', 10)
160
+
161
+ -# < >まで繰り返す
162
+ %block{:type => "#{category}_until"}
163
+
164
+ -# 繰り返しから脱出する
165
+ %block{:type => "#{category}_break"}
166
+
167
+ -# 次の繰り返しにジャンプする
168
+ %block{:type => "#{category}_next"}
169
+
170
+ -# 現在の繰り返しをやり直す
171
+ %block{:type => "#{category}_redo"}
172
+
173
+ %category{:name => '待つ'}
174
+ -# ( )秒待つ
175
+ %block{:type => "#{category}_sleep"}
176
+ = toolbox_number_value('SEC', 1)
177
+
178
+ -# < >まで待つ
179
+ %block{:type => "#{category}_await_until"}
180
+
181
+ -# 1フレーム待つ
182
+ %block{:type => "#{category}_await"}
183
+
184
+ %category{:name => 'もし~なら'}
185
+ -# もし< >なら
186
+ %block{:type => "#{category}_if"}
187
+
188
+ -# もし< >なら~でなければ
189
+ %block{:type => "#{category}_if_else"}
190
+
191
+ - category = 'sensing'
192
+ %category{:name => '調べる'}
193
+ -# 条件:キーボードの[▼キー]が[▼押された]
194
+ %block{:type => "#{category}_input_key_push_or_down"}
195
+ = toolbox_key_field
196
+
197
+ -# 条件:マウスの[▼左ボタン]が[▼押された]
198
+ %block{:type => "#{category}_input_mouse_push_or_down"}
199
+
200
+ -# 変数:マウスのx座標
201
+ %block{:type => "#{category}_input_mouse_pos_x"}
202
+
203
+ -# 変数:マウスのy座標
204
+ %block{:type => "#{category}_input_mouse_pos_y"}
205
+
206
+ -# 条件:[▼キャラクター]に触れた
207
+ %block{:type => "#{category}_hit"}
208
+
209
+ -# [ ]と聞いて待つ
210
+ -#%block{:type => "#{category}_ask"}
211
+ -# = toolbox_text_value('TEXT', 'あなたのお名前は?')
212
+
213
+ -# 変数:答え
214
+ -#%block{:type => "#{category}_answer"}
215
+
216
+ -# 変数:タイマー
217
+ -#%block{:type => "#{category}_timer_count"}
218
+
219
+ -# タイマーをリセット
220
+ -#%block{:type => "#{category}_timer_reset"}
221
+
222
+ -# 変数:[▼キャラクター]の[▼プロパティ]
223
+ %block{:type => "#{category}_character_property"}
224
+
225
+ -# 変数:現在の[▼時]
226
+ %block{:type => "#{category}_time_now"}
227
+
228
+ -# 変数:2000年からの日数
229
+ -#%block{:type => "#{category}_days_since_2000"}
230
+
231
+ - category = 'operators'
232
+ %category{:name => '計算'}
233
+ -# 変数:( ) + ( )
234
+ %block{:type => "#{category}_add"}
235
+
236
+ -# 変数:( ) - ( )
237
+ %block{:type => "#{category}_minus"}
238
+
239
+ -# 変数:( ) * ( )
240
+ %block{:type => "#{category}_multiply"}
241
+
242
+ -# 変数:( ) / ( )
243
+ %block{:type => "#{category}_divide"}
244
+
245
+ -# 変数:( )から( )までの乱数
246
+ %block{:type => "#{category}_rand"}
247
+ = toolbox_number_value('A', 1)
248
+ = toolbox_number_value('B', 10)
249
+
250
+ -# 変数:( )の[ ]番目
251
+ %block{:type => "#{category}_index_of"}
252
+ = toolbox_text_value('A', 'あいうえお')
253
+ = toolbox_number_value('INDEX', 1)
254
+
255
+ -# 変数:[ ]の長さ
256
+ %block{:type => "#{category}_length"}
257
+ = toolbox_text_value('A', 'あいうえお')
258
+
259
+ -# 変数:( )を( )で割った余り
260
+ %block{:type => "#{category}_modulo"}
261
+ = toolbox_number_value('A', 5)
262
+ = toolbox_number_value('B', 2)
263
+
264
+ -# 変数:( )を丸める
265
+ %block{:type => "#{category}_round"}
266
+ = toolbox_number_value('A', 0.5)
267
+
268
+ -# 変数:( )の[▼数学関数]
269
+ %block{:type => "#{category}_math_method"}
270
+ = toolbox_number_value('NUM', 9)
271
+ %field{:name => 'METHOD'}<
272
+ Math.sqrt(%num%)
273
+
274
+ -# テキスト
275
+ %block{:type => 'text'}
276
+ %field{:name => 'TEXT'}<
277
+ 文章
278
+
279
+ -# 数値
280
+ %block{:type => 'math_number'}
281
+ %field{:name => 'NUM'}<
282
+ 0
283
+
284
+ %category{:name => '条件'}
285
+ -# 条件:( ) < ( )
286
+ %block{:type => "#{category}_compare_gt"}
287
+
288
+ -# 条件:( ) <= ( )
289
+ %block{:type => "#{category}_compare_gte"}
290
+
291
+ -# 条件:( ) = ( )
292
+ %block{:type => "#{category}_compare_eq"}
293
+
294
+ -# 条件:( ) >= ( )
295
+ %block{:type => "#{category}_compare_lte"}
296
+
297
+ -# 条件:( ) > ( )
298
+ %block{:type => "#{category}_compare_lt"}
299
+
300
+ -# 条件:< > かつ < >
301
+ %block{:type => "#{category}_and"}
302
+
303
+ -# 条件:< > または < >
304
+ %block{:type => "#{category}_or"}
305
+
306
+ -# 条件:< > ではない
307
+ %block{:type => "#{category}_negate"}
308
+
309
+ -# 条件:真
310
+ %block{:type => "#{category}_true"}
311
+
312
+ -# 条件:偽
313
+ %block{:type => "#{category}_false"}
314
+
315
+ -#%category{:name => '変数', :custom => 'VARIABLE'}
316
+
317
+ - category = 'ruby'
318
+ %category{:name => 'Ruby'}
319
+ -# 文
320
+ %block{:type => "#{category}_statement"}
321
+
322
+ -# 式
323
+ %block{:type => "#{category}_expression"}
324
+
325
+ -# コメント
326
+ %block{:type => "#{category}_comment"}
327
+
328
+ -# p
329
+ %block{:type => "#{category}_p"}
330
+
331
+ - category = 'hardware'
332
+ %category{:name => 'ハードウェア'}
333
+ %category{:name => '準備'}
334
+ -# ハードウェアを準備する
335
+ %block{:type => "#{category}_init_hardware"}
336
+
337
+ %category{:name => 'LED'}
338
+ -# LED[▼ピン]をオンにする
339
+ %block{:type => "#{category}_led_on"}
340
+
341
+ -# LED[▼ピン]をオフにする
342
+ %block{:type => "#{category}_led_off"}
343
+
344
+ %category{:name => 'RGB LED'}
345
+ -# RGB LED[▼アノード]コモン[▼ピン]を[カラー]にする
346
+ %block{:type => "#{category}_rgb_led_on"}
347
+
348
+ -# RGB LED[▼アノード]コモン[▼ピン]をオフにする
349
+ %block{:type => "#{category}_rgb_led_off"}
350
+
351
+ -#%category{:name => '7セグディスプレイ'}
352
+ -# -# 7セグディスプレイに[▼0-9]を表示する
353
+ -# %block{:type => "#{category}_seven_segment_display_show"}
354
+ -#
355
+ -# -# 7セグディスプレイをオフにする
356
+ -# %block{:type => "#{category}_seven_segment_display_off"}
357
+
358
+ -#%category{:name => 'LCD'}
359
+ -# -# LCDに( )を表示する
360
+ -# %block{:type => "#{category}_lcd_puts"}
361
+ -# = toolbox_text_value('TEXT', 'Hello')
362
+ -#
363
+ -# -# LCDをクリアする
364
+ -# %block{:type => "#{category}_lcd_clear"}
365
+
366
+ -#%category{:name => 'ボタン'}
367
+ -# -# 条件:ボタン[▼]を押している
368
+ -# %block{:type => "#{category}_button_down"}
369
+ -#
370
+ -# -# 条件:ボタン[▼]を離している
371
+ -# %block{:type => "#{category}_button_up"}
372
+ -#
373
+ -# -# ボタン[▼]を押したとき
374
+ -# %block{:type => "#{category}_on_button_down"}
375
+ -#
376
+ -# -# ボタン[▼]を離したとき
377
+ -# %block{:type => "#{category}_on_button_up"}
378
+
379
+ %category{:name => 'センサー'}
380
+ -# センサー[▼PIN]
381
+ %block{:type => "#{category}_sensor_value"}
382
+
383
+ -# センサー[▼PIN]が変化したとき
384
+ %block{:type => "#{category}_on_sensor_change"}