Skip to content

Conversation

@t-kazu
Copy link
Collaborator

@t-kazu t-kazu commented Dec 4, 2018

refs #135

Copy link

@takaokouji takaokouji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一通り確認しました。お手数ですが、修正をお願いします。

};

Generator.music_menu_INSTRUMENT = function (block) {
const instrument = Generator.quote_(Generator.getFieldValue(block, 'INSTRUMENT') || '1');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instrumentは数値がいいと思います。

Suggested change
const instrument = Generator.quote_(Generator.getFieldValue(block, 'INSTRUMENT') || '1');
const instrument = Generator.getFieldValue(block, 'INSTRUMENT') || 1;

Copy link
Collaborator Author

@t-kazu t-kazu Dec 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screenshot from 2018-12-05 13-23-03
こういうブロックなので数値ではなく文字列にしました。
case文で"(1)ピアノ"と返す方が良かったりしますか? 数値でよければ数値で良いとは思います!!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

数値でいいです。
Ruby -> Blocksにするときに、数値で決めうちだと楽だからです。ユーザーがタイプするのも数値だと楽だしね。

Copy link

@takaokouji takaokouji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一通り確認しました。

@takaokouji
Copy link

videoまでやったらいったんマージしようかね。
videoのレビューは今晩やる予定。

Copy link

@takaokouji takaokouji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一通り確認しました。対応をよろしくお願いします。

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`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内部で video_motion の値を参照するようにします。whenに渡す第1引数の名称を変更します。

Suggested change
return `${Generator.spriteName()}.when(:greater_than, self.video_motion, ${rh}) do\n`;
return `${Generator.spriteName()}.when(:video_motion_greater_than, ${rh}) do\n`;

const subject = Generator.getFieldValue(block, 'SUBJECT') || 'wwww';
if (subject === 'Stage') {
return ['stage', Generator.ORDER_ATOMIC];
} else if(subject === 'this sprite') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if(subject === 'this sprite') {
} else if (subject === 'this sprite') {

if (subject === 'Stage') {
return ['stage', Generator.ORDER_ATOMIC];
} else if(subject === 'this sprite') {
return ['self', Generator.ORDER_ATOMIC];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

値の参照なので self は不要です。

Suggested change
return ['self', Generator.ORDER_ATOMIC];
return ['', Generator.ORDER_ATOMIC];

Generator.videoSensing_menu_SUBJECT = function (block) {
const subject = Generator.getFieldValue(block, 'SUBJECT') || 'wwww';
if (subject === 'Stage') {
return ['stage', Generator.ORDER_ATOMIC];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return ['stage', Generator.ORDER_ATOMIC];
return ['stage.', Generator.ORDER_ATOMIC];

} else if(subject === 'this sprite') {
return ['self', Generator.ORDER_ATOMIC];
}
return [subject, Generator.ORDER_ATOMIC];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return [subject, Generator.ORDER_ATOMIC];
return [`${subject}.`, Generator.ORDER_ATOMIC];

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];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return [`${subject}.video_${attribute}`, Generator.ORDER_ATOMIC];
return [`${subject}video_${attribute}`, Generator.ORDER_ATOMIC];


Generator.videoSensing_videoToggle = function (block) {
const video_state = Generator.valueToCode(block, 'VIDEO_STATE', Generator.ORDER_NONE);
return `turn_video(${video_state})\n`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

video関連は、なるべく video_なんたら というメソッド名にしたいと考えて、リネームしました。

Suggested change
return `turn_video(${video_state})\n`;
return `video_turn(${video_state})\n`;

};

Generator.music_menu_DRUM = function (block) {
const drum = Generator.quote_(Generator.getFieldValue(block, 'DRUM') || '1');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここも数値の方がよろしいでしょうか?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

はい、数値でお願いします。

@t-kazu t-kazu changed the title [WIP] 拡張のブロックをRubyに変換します 拡張のブロックをRubyに変換します Dec 7, 2018
@takaokouji takaokouji changed the title 拡張のブロックをRubyに変換します 拡張のブロック(Music, Pen, Video)をRubyに変換します Dec 7, 2018
@takaokouji takaokouji merged commit 318fa77 into smalruby:develop Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants