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.

Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/Guardfile +2 -0
  4. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +1 -1
  5. data/app/assets/javascripts/fix_blockly.js.erb +0 -50
  6. data/app/assets/javascripts/generators/ruby.js.coffee.erb +18 -4
  7. data/app/assets/javascripts/models/source_code.js +1 -1
  8. data/app/assets/javascripts/msg/en_us.js +1 -0
  9. data/app/assets/javascripts/msg/ja.js +4 -0
  10. data/app/assets/javascripts/smalruby.js.coffee.erb +50 -6
  11. data/app/assets/javascripts/views/main_menu_view.js.coffee.erb +14 -4
  12. data/app/assets/javascripts/views/preference_modal_view.js.coffee.erb +71 -0
  13. data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +5 -4
  14. data/app/assets/stylesheets/application.css +1 -0
  15. data/app/assets/stylesheets/preference-modal.css.scss +22 -0
  16. data/app/assets/stylesheets/toolbox.css.scss.erb +36 -0
  17. data/app/controllers/application_controller.rb +20 -4
  18. data/app/controllers/editor_controller.rb +4 -0
  19. data/app/controllers/sessions_controller.rb +7 -4
  20. data/app/controllers/source_codes_controller.rb +2 -2
  21. data/app/controllers/users_controller.rb +22 -0
  22. data/app/helpers/application_helper.rb +4 -4
  23. data/app/helpers/sessions_helper.rb +0 -0
  24. data/app/helpers/users_helper.rb +10 -0
  25. data/app/models/concerns/ruby_to_block/block/hardware_init_hardware.rb +0 -6
  26. data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +0 -0
  27. data/app/models/preference.rb +71 -0
  28. data/app/models/source_code.rb +4 -0
  29. data/app/models/user.rb +26 -0
  30. data/app/views/editor/_block_tab.html.haml +5 -6
  31. data/app/views/editor/_load_modal.html.haml +2 -2
  32. data/app/views/editor/_preference_modal.html.haml +16 -0
  33. data/app/views/editor/_signin_modal.html.haml +1 -1
  34. data/app/views/editor/_toolbox_default.html.haml +86 -79
  35. data/app/views/editor/{_toolbox_raspberrypi.html.haml → _toolbox_smalrubot.html.haml} +72 -105
  36. data/app/views/editor/_toolbox_smalrubot_s1.html.haml +1 -196
  37. data/app/views/editor/_toolbox_smalrubot_v3.html.haml +1 -196
  38. data/app/views/editor/index.html.haml +11 -4
  39. data/app/views/editor/toolbox.html.haml +1 -0
  40. data/app/views/layouts/application.html.erb +1 -1
  41. data/app/views/users/preferences.html.haml +34 -0
  42. data/config/application.rb +1 -1
  43. data/config/locales/en.yml +30 -0
  44. data/config/locales/ja.yml +30 -0
  45. data/config/routes.rb +4 -57
  46. data/db/migrate/20150513061200_create_users.rb +10 -0
  47. data/db/migrate/20150513061250_add_index_name_on_users.rb +9 -0
  48. data/db/schema.rb +10 -1
  49. data/lib/smalruby_editor.rb +22 -24
  50. data/lib/smalruby_editor/version.rb +1 -1
  51. data/smalruby-editor.gemspec +0 -0
  52. data/spec/acceptance/block_mode/blocks/hardware/button_pressed_or_released.feature +2 -0
  53. data/spec/acceptance/block_mode/blocks/hardware/init_hardware.feature +1 -0
  54. data/spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature +11 -1
  55. data/spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature +11 -1
  56. data/spec/acceptance/block_mode/blocks/hardware/motor_driver.feature +7 -1
  57. data/spec/acceptance/block_mode/blocks/hardware/motor_driver_speed.feature +2 -0
  58. data/spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature +9 -12
  59. data/spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature +9 -12
  60. data/spec/acceptance/block_mode/blocks/hardware/sensor_value.feature +59 -60
  61. data/spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature +76 -67
  62. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature +9 -12
  63. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature +9 -11
  64. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_dc_motor_power_ratio.feature +11 -12
  65. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +9 -10
  66. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature +9 -12
  67. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature +9 -11
  68. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_dc_motor_power_ratio.feature +11 -12
  69. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +9 -12
  70. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_sensor_value.feature +11 -12
  71. data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car.feature +7 -1
  72. data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car_speed.feature +2 -0
  73. data/spec/acceptance/standalone/preference.feature +92 -0
  74. data/{demos → spec/fixtures/files}/hardware_led.rb.xml +0 -0
  75. data/spec/javascripts/models/source_code_spec.coffee +0 -0
  76. data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_spec.rb +1 -1
  77. data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +4 -4
  78. data/spec/models/concerns/ruby_to_block_spec.rb +1 -1
  79. data/spec/models/source_code_spec.rb +1 -11
  80. data/spec/spec_helper.rb +8 -0
  81. data/spec/steps/base_steps.rb +68 -16
  82. data/spec/steps/standalone_steps.rb +21 -0
  83. data/spec/steps/text_editor_steps.rb +8 -8
  84. data/spec/support/feature_helper.rb +13 -0
  85. data/vendor/assets/javascripts/blockly/blockly_compressed.js +500 -454
  86. data/vendor/assets/javascripts/blockly/blocks_compressed.js +29 -28
  87. data/vendor/assets/javascripts/blockly/msg/js/ja.js +2 -1
  88. metadata +33 -35
  89. data/app/assets/stylesheets/toolbox_default.css.scss.erb +0 -34
  90. data/app/assets/stylesheets/toolbox_raspberrypi.css.scss.erb +0 -32
  91. data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +0 -32
  92. data/app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb +0 -32
  93. data/demos/adjust_2wd_car.rb.xml +0 -179
  94. data/lib/smalruby_editor/config.rb +0 -24
  95. data/spec/controllers/editor_controller_spec.rb +0 -12
  96. data/spec/controllers/sessions_controller_spec.rb +0 -74
  97. data/spec/helpers/sessions_helper_spec.rb +0 -15
@@ -1,100 +1,39 @@
1
+ -# @params type [String] s1, v3 and etc...
2
+ - subcategory = "smalrubot_#{type}"
1
3
  %xml{:id => 'toolbox', :style => 'display: none'}
2
- - category = 'motion'
3
4
  %category{:name => tt('.motion')}
4
- -# ( )歩動かす
5
- %block{:type => "#{category}_move"}
6
- = toolbox_number_value('STEP', 10)
5
+ - category = 'hardware'
6
+ %block{type: "#{category}_#{subcategory}_action"}
7
+ %field{name: 'ACTION'}<
8
+ forward
7
9
 
8
- -# 時計回りに( )度回す
9
- %block{:type => "#{category}_rotate_right"}
10
- = toolbox_number_value('ANGLE', 15)
10
+ %block{type: "#{category}_#{subcategory}_action_with_sec"}
11
+ %field{name: 'ACTION'}<
12
+ forward
13
+ = toolbox_number_value('SEC', 0.5)
11
14
 
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_character"}
22
-
23
- -# マウスポインターへ向ける
24
- %block{:type => "#{category}_point_towards_mouse"}
25
-
26
- -# [▼]へ行く
27
- %block{:type => "#{category}_go_to_character"}
28
-
29
- -# マウスポインターへ行く
30
- %block{:type => "#{category}_go_to_mouse"}
31
-
32
- -# x座標を( )ずつ変える
33
- %block{:type => "#{category}_change_x_by"}
34
- = toolbox_number_value('X', 10)
35
-
36
- -# x座標を( )にする
37
- %block{:type => "#{category}_set_x"}
38
- = toolbox_number_value('X', 0)
39
-
40
- -# y座標を( )ずつ変える
41
- %block{:type => "#{category}_change_y_by"}
42
- = toolbox_number_value('Y', 10)
43
-
44
- -# y座標を( )にする
45
- %block{:type => "#{category}_set_y"}
46
- = toolbox_number_value('Y', 0)
47
-
48
- -# もし端に着いたら、跳ね返る
49
- %block{:type => "#{category}_turn_if_reach_wall"}
50
-
51
- -# 跳ね返る
52
- %block{:type => "#{category}_turn"}
53
-
54
- -# [▼水平(X)]方向に跳ね返る
55
- %block{:type => "#{category}_turn_xy"}
56
-
57
- -# 回転方法を[▼]にする
58
- %block{:type => "#{category}_set_rotation_style"}
15
+ %block{type: "#{category}_#{subcategory}_dc_motor_set_power_ratio"}
16
+ = toolbox_number_value('SPEED', 100)
59
17
 
60
18
  - category = 'looks'
61
19
  %category{:name => tt('.looks')}
62
- -# [ ]と言う
63
20
  %block{:type => "#{category}_say"}
64
- = toolbox_text_value('TEXT', tt('.hello'))
65
-
66
- -# [ ]と考える
67
- -#%block{:type => "#{category}_think"}
68
- -# = toolbox_text_value('TEXT', 'ふーん')
69
-
70
- -# 表示する
71
- %block{:type => "#{category}_show"}
72
-
73
- -# 隠す
74
- %block{:type => "#{category}_hide"}
75
-
76
- -# 消滅する
77
- %block{:type => "#{category}_vanish"}
21
+ %value{name: 'TEXT'}
22
+ - category = 'hardware'
23
+ %block{type: "#{category}_#{subcategory}_sensor_value"}
78
24
 
79
- -# 大きさを( )%ずつ変える
80
- -#%block{:type => "#{category}_change_scale_by"}
81
- -# = toolbox_number_value('SCALE', 10)
82
-
83
- -# 大きさを( )%にする
84
- -#%block{:type => "#{category}_set_scale"}
85
- -# = toolbox_number_value('SCALE', 100)
25
+ - category = 'hardware'
26
+ %block{type: "#{category}_#{subcategory}_led_turn_on_or_off"}
27
+ %field{name: 'OOO'}<
28
+ turn_on
86
29
 
87
30
  - category = 'sound'
88
31
  %category{:name => tt('.sound')}
89
- -# [▼プリセット音声]の音を鳴らす
90
- %block{:type => "#{category}_play"}
91
- %value{:name => 'NAME'}
92
- %block{:type => "#{category}_preset_sounds"}
93
32
 
94
- -# すべての音を止める
95
- -#%block{:type => "#{category}_stop"}
33
+ - category = 'pen'
34
+ %category{:name => tt('.pen')}
96
35
 
97
- %category{name: tt('.data'), custom: 'VARIABLE'}
36
+ %category{:name => tt('.data'), :custom => 'VARIABLE'}
98
37
 
99
38
  - category = 'events'
100
39
  %category{:name => tt('.events')}
@@ -109,9 +48,6 @@
109
48
  -# キャラクターがクリックされたとき
110
49
  %block{:type => "#{category}_on_click"}
111
50
 
112
- -# [▼キャラクター]にぶつかったとき
113
- %block{:type => "#{category}_on_hit"}
114
-
115
51
  - category = 'control'
116
52
  %category{:name => tt('.control')}
117
53
  -# ( )秒待つ
@@ -131,27 +67,23 @@
131
67
  -# もし< >なら
132
68
  %block{:type => "#{category}_if"}
133
69
 
70
+ -# もし< >なら~でなければ
71
+ %block{:type => "#{category}_if_else"}
72
+
134
73
  -# < >まで待つ
135
74
  %block{:type => "#{category}_await_until"}
136
75
 
76
+ -# < >まで繰り返す
77
+ %block{:type => "#{category}_until"}
78
+
137
79
  -# 繰り返しから脱出する
138
80
  %block{:type => "#{category}_break"}
139
81
 
82
+ -# 次の繰り返しにジャンプする
83
+ %block{:type => "#{category}_next"}
84
+
140
85
  - category = 'sensing'
141
86
  %category{:name => tt('.sensing')}
142
- -# 条件:[▼キャラクター]に触れた
143
- %block{:type => "#{category}_hit"}
144
-
145
- -# 条件:端に触れた
146
- %block{:type => "#{category}_reach_wall"}
147
-
148
- -# [ ]と聞いて待つ
149
- -#%block{:type => "#{category}_ask"}
150
- -# = toolbox_text_value('TEXT', 'あなたのお名前は?')
151
-
152
- -# 変数:答え
153
- -#%block{:type => "#{category}_answer"}
154
-
155
87
  -# 条件:キーボードの[▼キー]が[▼押された]
156
88
  %block{:type => "#{category}_input_key_push_or_down"}
157
89
  = toolbox_key_field
@@ -161,11 +93,12 @@
161
93
  %block{:type => "#{category}_input_mouse_push_or_down"}
162
94
  = toolbox_pod_field
163
95
 
164
- -# 変数:マウスのx座標
165
- %block{:type => "#{category}_input_mouse_pos_x"}
96
+ -# [ ]と聞いて待つ
97
+ -#%block{:type => "#{category}_ask"}
98
+ -# = toolbox_text_value('TEXT', 'あなたのお名前は?')
166
99
 
167
- -# 変数:マウスのy座標
168
- %block{:type => "#{category}_input_mouse_pos_y"}
100
+ -# 変数:答え
101
+ -#%block{:type => "#{category}_answer"}
169
102
 
170
103
  -# 変数:タイマー
171
104
  -#%block{:type => "#{category}_timer_count"}
@@ -173,8 +106,9 @@
173
106
  -# タイマーをリセット
174
107
  -#%block{:type => "#{category}_timer_reset"}
175
108
 
176
- -# 変数:[▼キャラクター]の[▼プロパティ]
177
- %block{:type => "#{category}_character_property"}
109
+ - category = 'hardware'
110
+ %block{type: "#{category}_#{subcategory}_sensor_value"}
111
+ %block{type: "#{category}_#{subcategory}_dc_motor_power_ratio"}
178
112
 
179
113
  - category = 'operators'
180
114
  %category{:name => tt('.operators')}
@@ -208,9 +142,15 @@
208
142
  -# 条件:( ) < ( )
209
143
  %block{:type => "#{category}_compare_lt"}
210
144
 
145
+ -# 条件:( ) <= ( )
146
+ %block{:type => "#{category}_compare_lte"}
147
+
211
148
  -# 条件:( ) = ( )
212
149
  %block{:type => "#{category}_compare_eq"}
213
150
 
151
+ -# 条件:( ) >= ( )
152
+ %block{:type => "#{category}_compare_gte"}
153
+
214
154
  -# 条件:( ) > ( )
215
155
  %block{:type => "#{category}_compare_gt"}
216
156
 
@@ -223,6 +163,15 @@
223
163
  -# 条件:< > ではない
224
164
  %block{:type => "#{category}_negate"}
225
165
 
166
+ -# 変数:( )の( )番目
167
+ %block{:type => "#{category}_index_of"}
168
+ = toolbox_text_value('A', tt('.world'))
169
+ = toolbox_number_value('INDEX', 1)
170
+
171
+ -# 変数:( )の長さ
172
+ %block{:type => "#{category}_length"}
173
+ = toolbox_text_value('A', tt('.world'))
174
+
226
175
  -# 変数:( )を( )で割った余り
227
176
  %block{:type => "#{category}_modulo"}
228
177
  = toolbox_number_value('A', 5)
@@ -231,3 +180,21 @@
231
180
  -# 変数:( )を四捨五入
232
181
  %block{:type => "#{category}_round"}
233
182
  = toolbox_number_value('A', 0.5)
183
+
184
+ -# 変数:( )の[▼数学関数]
185
+ %block{:type => "#{category}_math_method"}
186
+ = toolbox_number_value('NUM', 9)
187
+ %field{:name => 'METHOD'}<
188
+ Math.sqrt(%num%)
189
+
190
+ -# 条件:真
191
+ %block{:type => "#{category}_true"}
192
+
193
+ -# 条件:偽
194
+ %block{:type => "#{category}_false"}
195
+
196
+ %category{:name => tt('.etc')}
197
+ - if !current_preferences["enabled_auto_init_hardware"]
198
+ - category = 'hardware'
199
+ -# ハードウェアを準備する
200
+ %block{:type => "#{category}_init_hardware"}
@@ -1,196 +1 @@
1
- %xml{:id => 'toolbox', :style => 'display: none'}
2
- %category{:name => tt('.motion')}
3
- - category = 'hardware'
4
- - subcategory = 'smalrubot_s1'
5
- %block{type: "#{category}_#{subcategory}_action"}
6
- %field{name: 'ACTION'}<
7
- forward
8
-
9
- %block{type: "#{category}_#{subcategory}_action_with_sec"}
10
- %field{name: 'ACTION'}<
11
- forward
12
- = toolbox_number_value('SEC', 0.5)
13
-
14
- %block{type: "#{category}_#{subcategory}_dc_motor_set_power_ratio"}
15
- = toolbox_number_value('SPEED', 100)
16
-
17
- - category = 'looks'
18
- %category{:name => tt('.looks')}
19
- %block{:type => "#{category}_say"}
20
- %value{name: 'TEXT'}
21
- - category = 'hardware'
22
- - subcategory = 'smalrubot_s1'
23
- %block{type: "#{category}_#{subcategory}_sensor_value"}
24
-
25
- - category = 'hardware'
26
- - subcategory = 'smalrubot_s1'
27
- %block{type: "#{category}_#{subcategory}_led_turn_on_or_off"}
28
- %field{name: 'OOO'}<
29
- turn_on
30
-
31
- %category{:name => tt('.data'), :custom => 'VARIABLE'}
32
-
33
- - category = 'events'
34
- %category{:name => tt('.events')}
35
- -# まずは
36
- %block{:type => "#{category}_on_start"}
37
-
38
- -# キーボードの[▼キー]が[▼押された/押され続けている]とき
39
- %block{:type => "#{category}_on_key_push_or_down"}
40
- = toolbox_key_field
41
- = toolbox_pod_field
42
-
43
- -# キャラクターがクリックされたとき
44
- %block{:type => "#{category}_on_click"}
45
-
46
- - category = 'control'
47
- %category{:name => tt('.control')}
48
- -# ( )秒待つ
49
- %block{:type => "#{category}_sleep"}
50
- = toolbox_number_value('SEC', 1)
51
-
52
- -# ほんの少し待つ
53
- %block{:type => "#{category}_await"}
54
-
55
- -# ( )回繰り返す
56
- %block{:type => "#{category}_times"}
57
- = toolbox_number_value('COUNT', 10)
58
-
59
- -# ずっと
60
- %block{:type => "#{category}_loop"}
61
-
62
- -# もし< >なら
63
- %block{:type => "#{category}_if"}
64
-
65
- -# もし< >なら~でなければ
66
- %block{:type => "#{category}_if_else"}
67
-
68
- -# < >まで待つ
69
- %block{:type => "#{category}_await_until"}
70
-
71
- -# < >まで繰り返す
72
- %block{:type => "#{category}_until"}
73
-
74
- -# 繰り返しから脱出する
75
- %block{:type => "#{category}_break"}
76
-
77
- -# 次の繰り返しにジャンプする
78
- %block{:type => "#{category}_next"}
79
-
80
- - category = 'sensing'
81
- %category{:name => tt('.sensing')}
82
- -# 条件:キーボードの[▼キー]が[▼押された]
83
- %block{:type => "#{category}_input_key_push_or_down"}
84
- = toolbox_key_field
85
- = toolbox_pod_field
86
-
87
- -# 条件:マウスの[▼左ボタン]が[▼押された]
88
- %block{:type => "#{category}_input_mouse_push_or_down"}
89
- = toolbox_pod_field
90
-
91
- -# [ ]と聞いて待つ
92
- -#%block{:type => "#{category}_ask"}
93
- -# = toolbox_text_value('TEXT', 'あなたのお名前は?')
94
-
95
- -# 変数:答え
96
- -#%block{:type => "#{category}_answer"}
97
-
98
- -# 変数:タイマー
99
- -#%block{:type => "#{category}_timer_count"}
100
-
101
- -# タイマーをリセット
102
- -#%block{:type => "#{category}_timer_reset"}
103
-
104
- - category = 'hardware'
105
- - subcategory = 'smalrubot_s1'
106
- %block{type: "#{category}_#{subcategory}_sensor_value"}
107
- %block{type: "#{category}_#{subcategory}_dc_motor_power_ratio"}
108
-
109
- - category = 'operators'
110
- %category{:name => tt('.operators')}
111
- -# 数値
112
- %block{:type => 'math_number'}
113
- %field{:name => 'NUM'}<
114
- 0
115
-
116
- -# テキスト
117
- %block{:type => 'text'}
118
- %field{:name => 'TEXT'}<
119
- = tt('.text')
120
-
121
- -# 変数:( ) + ( )
122
- %block{:type => "#{category}_add"}
123
-
124
- -# 変数:( ) - ( )
125
- %block{:type => "#{category}_minus"}
126
-
127
- -# 変数:( ) * ( )
128
- %block{:type => "#{category}_multiply"}
129
-
130
- -# 変数:( ) / ( )
131
- %block{:type => "#{category}_divide"}
132
-
133
- -# 変数:( )から( )までの乱数
134
- %block{:type => "#{category}_rand"}
135
- = toolbox_number_value('A', 1)
136
- = toolbox_number_value('B', 10)
137
-
138
- -# 条件:( ) < ( )
139
- %block{:type => "#{category}_compare_lt"}
140
-
141
- -# 条件:( ) <= ( )
142
- %block{:type => "#{category}_compare_lte"}
143
-
144
- -# 条件:( ) = ( )
145
- %block{:type => "#{category}_compare_eq"}
146
-
147
- -# 条件:( ) >= ( )
148
- %block{:type => "#{category}_compare_gte"}
149
-
150
- -# 条件:( ) > ( )
151
- %block{:type => "#{category}_compare_gt"}
152
-
153
- -# 条件:< > かつ < >
154
- %block{:type => "#{category}_and"}
155
-
156
- -# 条件:< > または < >
157
- %block{:type => "#{category}_or"}
158
-
159
- -# 条件:< > ではない
160
- %block{:type => "#{category}_negate"}
161
-
162
- -# 変数:( )の( )番目
163
- %block{:type => "#{category}_index_of"}
164
- = toolbox_text_value('A', tt('.world'))
165
- = toolbox_number_value('INDEX', 1)
166
-
167
- -# 変数:( )の長さ
168
- %block{:type => "#{category}_length"}
169
- = toolbox_text_value('A', tt('.world'))
170
-
171
- -# 変数:( )を( )で割った余り
172
- %block{:type => "#{category}_modulo"}
173
- = toolbox_number_value('A', 5)
174
- = toolbox_number_value('B', 2)
175
-
176
- -# 変数:( )を四捨五入
177
- %block{:type => "#{category}_round"}
178
- = toolbox_number_value('A', 0.5)
179
-
180
- -# 変数:( )の[▼数学関数]
181
- %block{:type => "#{category}_math_method"}
182
- = toolbox_number_value('NUM', 9)
183
- %field{:name => 'METHOD'}<
184
- Math.sqrt(%num%)
185
-
186
- -# 条件:真
187
- %block{:type => "#{category}_true"}
188
-
189
- -# 条件:偽
190
- %block{:type => "#{category}_false"}
191
-
192
- - if !SmalrubyEditor::Config.enabled?('auto_init_hardware')
193
- %category{:name => tt('.etc')}
194
- - category = 'hardware'
195
- -# ハードウェアを準備する
196
- %block{:type => "#{category}_init_hardware"}
1
+ = render(partial: "toolbox_smalrubot", locals: { type: "s1" })
@@ -1,196 +1 @@
1
- %xml{:id => 'toolbox', :style => 'display: none'}
2
- %category{:name => tt('.motion')}
3
- - category = 'hardware'
4
- - subcategory = 'smalrubot_v3'
5
- %block{type: "#{category}_#{subcategory}_action"}
6
- %field{name: 'ACTION'}<
7
- forward
8
-
9
- %block{type: "#{category}_#{subcategory}_action_with_sec"}
10
- %field{name: 'ACTION'}<
11
- forward
12
- = toolbox_number_value('SEC', 0.5)
13
-
14
- %block{type: "#{category}_#{subcategory}_dc_motor_set_power_ratio"}
15
- = toolbox_number_value('SPEED', 100)
16
-
17
- - category = 'looks'
18
- %category{:name => tt('.looks')}
19
- %block{:type => "#{category}_say"}
20
- %value{name: 'TEXT'}
21
- - category = 'hardware'
22
- - subcategory = 'smalrubot_v3'
23
- %block{type: "#{category}_#{subcategory}_sensor_value"}
24
-
25
- - category = 'hardware'
26
- - subcategory = 'smalrubot_v3'
27
- %block{type: "#{category}_#{subcategory}_led_turn_on_or_off"}
28
- %field{name: 'OOO'}<
29
- turn_on
30
-
31
- %category{:name => tt('.data'), :custom => 'VARIABLE'}
32
-
33
- - category = 'events'
34
- %category{:name => tt('.events')}
35
- -# まずは
36
- %block{:type => "#{category}_on_start"}
37
-
38
- -# キーボードの[▼キー]が[▼押された/押され続けている]とき
39
- %block{:type => "#{category}_on_key_push_or_down"}
40
- = toolbox_key_field
41
- = toolbox_pod_field
42
-
43
- -# キャラクターがクリックされたとき
44
- %block{:type => "#{category}_on_click"}
45
-
46
- - category = 'control'
47
- %category{:name => tt('.control')}
48
- -# ( )秒待つ
49
- %block{:type => "#{category}_sleep"}
50
- = toolbox_number_value('SEC', 1)
51
-
52
- -# ほんの少し待つ
53
- %block{:type => "#{category}_await"}
54
-
55
- -# ( )回繰り返す
56
- %block{:type => "#{category}_times"}
57
- = toolbox_number_value('COUNT', 10)
58
-
59
- -# ずっと
60
- %block{:type => "#{category}_loop"}
61
-
62
- -# もし< >なら
63
- %block{:type => "#{category}_if"}
64
-
65
- -# もし< >なら~でなければ
66
- %block{:type => "#{category}_if_else"}
67
-
68
- -# < >まで待つ
69
- %block{:type => "#{category}_await_until"}
70
-
71
- -# < >まで繰り返す
72
- %block{:type => "#{category}_until"}
73
-
74
- -# 繰り返しから脱出する
75
- %block{:type => "#{category}_break"}
76
-
77
- -# 次の繰り返しにジャンプする
78
- %block{:type => "#{category}_next"}
79
-
80
- - category = 'sensing'
81
- %category{:name => tt('.sensing')}
82
- -# 条件:キーボードの[▼キー]が[▼押された]
83
- %block{:type => "#{category}_input_key_push_or_down"}
84
- = toolbox_key_field
85
- = toolbox_pod_field
86
-
87
- -# 条件:マウスの[▼左ボタン]が[▼押された]
88
- %block{:type => "#{category}_input_mouse_push_or_down"}
89
- = toolbox_pod_field
90
-
91
- -# [ ]と聞いて待つ
92
- -#%block{:type => "#{category}_ask"}
93
- -# = toolbox_text_value('TEXT', 'あなたのお名前は?')
94
-
95
- -# 変数:答え
96
- -#%block{:type => "#{category}_answer"}
97
-
98
- -# 変数:タイマー
99
- -#%block{:type => "#{category}_timer_count"}
100
-
101
- -# タイマーをリセット
102
- -#%block{:type => "#{category}_timer_reset"}
103
-
104
- - category = 'hardware'
105
- - subcategory = 'smalrubot_v3'
106
- %block{type: "#{category}_#{subcategory}_sensor_value"}
107
- %block{type: "#{category}_#{subcategory}_dc_motor_power_ratio"}
108
-
109
- - category = 'operators'
110
- %category{:name => tt('.operators')}
111
- -# 数値
112
- %block{:type => 'math_number'}
113
- %field{:name => 'NUM'}<
114
- 0
115
-
116
- -# テキスト
117
- %block{:type => 'text'}
118
- %field{:name => 'TEXT'}<
119
- = tt('.text')
120
-
121
- -# 変数:( ) + ( )
122
- %block{:type => "#{category}_add"}
123
-
124
- -# 変数:( ) - ( )
125
- %block{:type => "#{category}_minus"}
126
-
127
- -# 変数:( ) * ( )
128
- %block{:type => "#{category}_multiply"}
129
-
130
- -# 変数:( ) / ( )
131
- %block{:type => "#{category}_divide"}
132
-
133
- -# 変数:( )から( )までの乱数
134
- %block{:type => "#{category}_rand"}
135
- = toolbox_number_value('A', 1)
136
- = toolbox_number_value('B', 10)
137
-
138
- -# 条件:( ) < ( )
139
- %block{:type => "#{category}_compare_lt"}
140
-
141
- -# 条件:( ) <= ( )
142
- %block{:type => "#{category}_compare_lte"}
143
-
144
- -# 条件:( ) = ( )
145
- %block{:type => "#{category}_compare_eq"}
146
-
147
- -# 条件:( ) >= ( )
148
- %block{:type => "#{category}_compare_gte"}
149
-
150
- -# 条件:( ) > ( )
151
- %block{:type => "#{category}_compare_gt"}
152
-
153
- -# 条件:< > かつ < >
154
- %block{:type => "#{category}_and"}
155
-
156
- -# 条件:< > または < >
157
- %block{:type => "#{category}_or"}
158
-
159
- -# 条件:< > ではない
160
- %block{:type => "#{category}_negate"}
161
-
162
- -# 変数:( )の( )番目
163
- %block{:type => "#{category}_index_of"}
164
- = toolbox_text_value('A', tt('.world'))
165
- = toolbox_number_value('INDEX', 1)
166
-
167
- -# 変数:( )の長さ
168
- %block{:type => "#{category}_length"}
169
- = toolbox_text_value('A', tt('.world'))
170
-
171
- -# 変数:( )を( )で割った余り
172
- %block{:type => "#{category}_modulo"}
173
- = toolbox_number_value('A', 5)
174
- = toolbox_number_value('B', 2)
175
-
176
- -# 変数:( )を四捨五入
177
- %block{:type => "#{category}_round"}
178
- = toolbox_number_value('A', 0.5)
179
-
180
- -# 変数:( )の[▼数学関数]
181
- %block{:type => "#{category}_math_method"}
182
- = toolbox_number_value('NUM', 9)
183
- %field{:name => 'METHOD'}<
184
- Math.sqrt(%num%)
185
-
186
- -# 条件:真
187
- %block{:type => "#{category}_true"}
188
-
189
- -# 条件:偽
190
- %block{:type => "#{category}_false"}
191
-
192
- - if !SmalrubyEditor::Config.enabled?('auto_init_hardware')
193
- %category{:name => tt('.etc')}
194
- - category = 'hardware'
195
- -# ハードウェアを準備する
196
- %block{:type => "#{category}_init_hardware"}
1
+ = render(partial: "toolbox_smalrubot", locals: { type: "v3" })