-
-
Notifications
You must be signed in to change notification settings - Fork 16
拡張のブロック(Music, Pen, Video)をRubyに変換します #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
拡張のブロック(Music, Pen, Video)をRubyに変換します #143
Conversation
takaokouji
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一通り確認しました。お手数ですが、修正をお願いします。
src/lib/ruby-generator/music.js
Outdated
| }; | ||
|
|
||
| Generator.music_menu_INSTRUMENT = function (block) { | ||
| const instrument = Generator.quote_(Generator.getFieldValue(block, 'INSTRUMENT') || '1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instrumentは数値がいいと思います。
| const instrument = Generator.quote_(Generator.getFieldValue(block, 'INSTRUMENT') || '1'); | |
| const instrument = Generator.getFieldValue(block, 'INSTRUMENT') || 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
数値でいいです。
Ruby -> Blocksにするときに、数値で決めうちだと楽だからです。ユーザーがタイプするのも数値だと楽だしね。
takaokouji
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一通り確認しました。
|
videoまでやったらいったんマージしようかね。 |
takaokouji
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一通り確認しました。対応をよろしくお願いします。
src/lib/ruby-generator/video.js
Outdated
| Generator.videoSensing_whenMotionGreaterThan = function (block) { | ||
| block.isStatement = true; | ||
| const rh = Generator.valueToCode(block, 'REFERENCE', Generator.ORDER_NONE) || 0; | ||
| return `${Generator.spriteName()}.when(:greater_than, self.video_motion, ${rh}) do\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
内部で video_motion の値を参照するようにします。whenに渡す第1引数の名称を変更します。
| return `${Generator.spriteName()}.when(:greater_than, self.video_motion, ${rh}) do\n`; | |
| return `${Generator.spriteName()}.when(:video_motion_greater_than, ${rh}) do\n`; |
src/lib/ruby-generator/video.js
Outdated
| const subject = Generator.getFieldValue(block, 'SUBJECT') || 'wwww'; | ||
| if (subject === 'Stage') { | ||
| return ['stage', Generator.ORDER_ATOMIC]; | ||
| } else if(subject === 'this sprite') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } else if(subject === 'this sprite') { | |
| } else if (subject === 'this sprite') { |
src/lib/ruby-generator/video.js
Outdated
| if (subject === 'Stage') { | ||
| return ['stage', Generator.ORDER_ATOMIC]; | ||
| } else if(subject === 'this sprite') { | ||
| return ['self', Generator.ORDER_ATOMIC]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
値の参照なので self は不要です。
| return ['self', Generator.ORDER_ATOMIC]; | |
| return ['', Generator.ORDER_ATOMIC]; |
src/lib/ruby-generator/video.js
Outdated
| Generator.videoSensing_menu_SUBJECT = function (block) { | ||
| const subject = Generator.getFieldValue(block, 'SUBJECT') || 'wwww'; | ||
| if (subject === 'Stage') { | ||
| return ['stage', Generator.ORDER_ATOMIC]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return ['stage', Generator.ORDER_ATOMIC]; | |
| return ['stage.', Generator.ORDER_ATOMIC]; |
src/lib/ruby-generator/video.js
Outdated
| } else if(subject === 'this sprite') { | ||
| return ['self', Generator.ORDER_ATOMIC]; | ||
| } | ||
| return [subject, Generator.ORDER_ATOMIC]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return [subject, Generator.ORDER_ATOMIC]; | |
| return [`${subject}.`, Generator.ORDER_ATOMIC]; |
src/lib/ruby-generator/video.js
Outdated
| Generator.videoSensing_videoOn = function (block) { | ||
| const attribute = Generator.valueToCode(block, 'ATTRIBUTE', Generator.ORDER_NONE); | ||
| const subject = Generator.valueToCode(block, 'SUBJECT', Generator.ORDER_NONE); | ||
| return [`${subject}.video_${attribute}`, Generator.ORDER_ATOMIC]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return [`${subject}.video_${attribute}`, Generator.ORDER_ATOMIC]; | |
| return [`${subject}video_${attribute}`, Generator.ORDER_ATOMIC]; |
src/lib/ruby-generator/video.js
Outdated
|
|
||
| Generator.videoSensing_videoToggle = function (block) { | ||
| const video_state = Generator.valueToCode(block, 'VIDEO_STATE', Generator.ORDER_NONE); | ||
| return `turn_video(${video_state})\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
video関連は、なるべく video_なんたら というメソッド名にしたいと考えて、リネームしました。
| return `turn_video(${video_state})\n`; | |
| return `video_turn(${video_state})\n`; |
src/lib/ruby-generator/music.js
Outdated
| }; | ||
|
|
||
| Generator.music_menu_DRUM = function (block) { | ||
| const drum = Generator.quote_(Generator.getFieldValue(block, 'DRUM') || '1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここも数値の方がよろしいでしょうか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
はい、数値でお願いします。

refs #135