Skip to content

Commit 309d249

Browse files
authored
Merge pull request #2988 from poqopo/develop-hw
팀보로봇 블록 로직 변경
2 parents d7dca79 + f480109 commit 309d249

File tree

1 file changed

+26
-36
lines changed

1 file changed

+26
-36
lines changed

src/playground/blocks/hardware/block_timbo.js

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Entry.Timbo = {
44
id: '6A.1',
55
name: 'Timbo',
6+
67
title: {
78
ko: '팀보 커뮤니케이션 블록',
89
en: 'Timbo Communication Block',
@@ -21,7 +22,7 @@ Entry.Timbo.setLanguage = function () {
2122
return {
2223
ko: {
2324
template: {
24-
timbo_queen_play: '퀸의 %1켜기',
25+
timbo_queen_play: '퀸의 %1 켜기',
2526
timbo_queen_stop: '퀸의 동작 끄기',
2627
timbo_motion_play: '모션 %1의 %2 켜기',
2728
timbo_motion_stop: '모션 %1의 동작 끄기',
@@ -35,12 +36,12 @@ Entry.Timbo.setLanguage = function () {
3536
timbo: '팀보',
3637
},
3738
Helper: {
38-
timbo_queen_play: '퀸의 %1켜기',
39-
timbo_queen_stop: '퀸의 동작 끄기',
40-
timbo_motion_play: '모션 %1의 %2 켜기',
41-
timbo_motion_stop: '모션 %1의 동작 끄기',
42-
timbo_check_queen: '퀸의 동작여부 체크',
43-
timbo_check_motion: '모션 %1의 동작여부 체크',
39+
timbo_queen_play: '퀸의 동작을 선택하여 켭니다.',
40+
timbo_queen_stop: '퀸의 동작을 멈춥니다.',
41+
timbo_motion_play: '지정한 모션 번호와 동작 타입으로 모션을 실행합니다.',
42+
timbo_motion_stop: '지정한 모션 번호의 동작을 멈춥니다.',
43+
timbo_check_queen: '퀸이 동작 중인지 확인합니다.',
44+
timbo_check_motion: '지정한 모션 번호가 동작 중인지 확인합니다.',
4445
},
4546
},
4647
en: {
@@ -59,12 +60,12 @@ Entry.Timbo.setLanguage = function () {
5960
timbo: 'Timbo',
6061
},
6162
Helper: {
62-
timbo_queen_play: 'Turn on Queen %1',
63-
timbo_queen_stop: 'Turn off Queen action',
64-
timbo_motion_play: 'Turn on Motion %1 of %2',
65-
timbo_motion_stop: 'Turn off Motion %1 action',
66-
timbo_check_queen: 'Check if Queen is operating',
67-
timbo_check_motion: 'Check if Motion %1 is operating',
63+
timbo_queen_play: 'Turn on selected Queen action.',
64+
timbo_queen_stop: 'Stop all Queen actions.',
65+
timbo_motion_play: 'Execute specific Motion with given type.',
66+
timbo_motion_stop: 'Stop Motion action of given ID.',
67+
timbo_check_queen: 'Check if Queen is currently operating.',
68+
timbo_check_motion: 'Check if selected Motion is currently operating.',
6869
},
6970
},
7071
};
@@ -85,7 +86,7 @@ Entry.Timbo.getBlocks = function () {
8586
color: EntryStatic.colorSet.block.default.HARDWARE,
8687
outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
8788
skeleton: 'basic',
88-
statements: [],
89+
template: Lang.template.timbo_queen_play,
8990
params: [
9091
{
9192
type: 'Dropdown',
@@ -101,18 +102,13 @@ Entry.Timbo.getBlocks = function () {
101102
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
102103
},
103104
],
104-
events: {},
105-
def: {
106-
params: [],
107-
type: 'timbo_queen_play',
108-
},
109105
paramsKeyMap: {
110106
ACTION: 0,
111107
},
112-
class: 'timbo_queen',
108+
class: 'timbo',
113109
isNotFor: ['Timbo'],
114110
func(sprite, script) {
115-
const action = script.getNumberValue('ACTION');
111+
const action = Number(script.getField('ACTION'));
116112
Entry.hw.setDigitalPortValue(1, action);
117113
return script.callReturn();
118114
},
@@ -121,18 +117,12 @@ Entry.Timbo.getBlocks = function () {
121117
color: EntryStatic.colorSet.block.default.HARDWARE,
122118
outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
123119
skeleton: 'basic',
124-
statements: [],
120+
template: Lang.template.timbo_queen_stop,
125121
params: [],
126-
events: {},
127-
def: {
128-
params: [],
129-
type: 'timbo_queen_stop',
130-
},
131-
paramsKeyMap: {},
132-
class: 'timbo_queen',
122+
class: 'timbo',
133123
isNotFor: ['Timbo'],
134124
func(sprite, script) {
135-
Entry.hw.setDigitalPortValue(1, 0);
125+
Entry.hw.setDigitalPortValue(1, 5);
136126
return script.callReturn();
137127
},
138128
},
@@ -174,7 +164,7 @@ Entry.Timbo.getBlocks = function () {
174164
],
175165
events: {},
176166
def: {
177-
params: [null],
167+
params: [null, null],
178168
type: 'timbo_motion_play',
179169
},
180170
paramsKeyMap: {
@@ -184,8 +174,8 @@ Entry.Timbo.getBlocks = function () {
184174
class: 'timbo_motion',
185175
isNotFor: ['Timbo'],
186176
func(sprite, script) {
187-
const port = script.getNumberValue('PORT');
188-
const action = script.getNumberValue('ACTION');
177+
const port = Number(script.getField('PORT'));
178+
const action = Number(script.getField('ACTION'));
189179
Entry.hw.setDigitalPortValue(port + 1, action);
190180
return script.callReturn();
191181
},
@@ -238,8 +228,8 @@ Entry.Timbo.getBlocks = function () {
238228
class: 'timbo_motion',
239229
isNotFor: ['Timbo'],
240230
func(sprite, script) {
241-
const port = script.getNumberValue('PORT');
242-
Entry.hw.setDigitalPortValue(port + 1, 0);
231+
const port = Number(script.getField('PORT'));
232+
Entry.hw.setDigitalPortValue(port + 1, 5);
243233
return script.callReturn();
244234
},
245235
},
@@ -279,7 +269,7 @@ Entry.Timbo.getBlocks = function () {
279269
class: 'timbo_motion_value',
280270
isNotFor: ['Timbo'],
281271
func(sprite, script) {
282-
const port = script.getNumberValue('PORT');
272+
const port = Number(script.getField('PORT'));
283273
return Entry.hw.getDigitalPortValue(port + 1);
284274
},
285275
},

0 commit comments

Comments
 (0)