Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a261a79
Merge pull request #2421 from entrylabs/develop
Tnks2U Jan 2, 2023
1d1e259
feat: 일반 연결시 마이크로비트 버튼 시작이벤트 구현
Tnks2U Jan 3, 2023
acb5c24
feat: 마빗2 버튼 시작하기 블록정보 추가
Tnks2U Jan 6, 2023
3ae173a
Merge pull request #2427 from entrylabs/issue/microbit_eventblock
Tnks2U Jan 11, 2023
11886ee
Merge branch 'develop' into develop-hw
Tnks2U Jan 17, 2023
6fb7e36
feat: 웹연결 버튼 조건 변경
Tnks2U Jan 17, 2023
91b40e6
Merge pull request #2428 from entrylabs/issue/5460
Tnks2U Jan 17, 2023
a1d06e7
Change the icobot_get_discomfort_index_value
Yejin715 Jan 17, 2023
7085cca
Change The LED Block
Yejin715 Jan 18, 2023
a417a8c
Revert "feat: 마빗2 버튼 시작하기 블록정보 추가"
Tnks2U Jan 19, 2023
e102354
refactor: 미사용 모듈 제거
Tnks2U Jan 19, 2023
3c26cae
feat: 버튼이벤트에 쓰로틀링 추가
Tnks2U Jan 19, 2023
d791e17
chore: 불필요한 console.log 제거
Tnks2U Jan 19, 2023
5519196
comment: 버튼이벤트 로직주석추가
Tnks2U Jan 19, 2023
c79e53e
Merge pull request #2429 from Yejin715/develop-hw
Tnks2U Jan 19, 2023
4489503
Merge pull request #2431 from entrylabs/issue/microbit_eventblock
Tnks2U Jan 19, 2023
ba4a1ff
feat: 버튼이벤트 블록 위치 수정
Tnks2U Jan 19, 2023
0f503fb
Merge pull request #2432 from entrylabs/issue/microbit_eventblock
Tnks2U Jan 19, 2023
46f7761
feat: 이벤트 중복 방지 interval 수정
Tnks2U Jan 19, 2023
572d911
Merge pull request #2433 from entrylabs/develop
Tnks2U Jan 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/class/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,17 @@ Entry.Engine = class Engine {
Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, eventName);
}

/**
* @param {string} eventName
* @param {string} value
*/
fireEventWithValue(eventName, value) {
if (this.state !== EntryEngineState.run) {
return;
}
return Entry.container.mapEntityIncludeCloneOnScene(this.raiseKeyEvent, [eventName, value]);
}

/**
* this is callback function for map.
* @param {Entry.EntryObject} object
Expand Down
14 changes: 9 additions & 5 deletions src/class/hw_lite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,15 @@ export default class HardwareLite {

isHwLiteSupportAgent() {
const userAgentString = navigator.userAgent.toLowerCase();
return (
userAgentString.indexOf('chrome') >= 0 &&
userAgentString.indexOf('window') < 0 &&
userAgentString.indexOf('electron') < 0
);

// INFO: 디바이스가 모바일이거나 일렉트론이면 1차적으로 제외
if (userAgentString.includes('mobile') || userAgentString.includes('electron')) {
return false;
} else if (userAgentString.includes('whale') || userAgentString.includes('edge') || userAgentString.includes('chrome')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] <max-len> reported by reviewdog 🐶
This line has a length of 129. Maximum allowed is 100.

Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace userAgentString.includes('whale')·||·userAgentString.includes('edge')·||·userAgentString.includes('chrome') with ⏎············userAgentString.includes('whale')·||⏎············userAgentString.includes('edge')·||⏎············userAgentString.includes('chrome')⏎········

Suggested change
} else if (userAgentString.includes('whale') || userAgentString.includes('edge') || userAgentString.includes('chrome')) {
} else if (
userAgentString.includes('whale') ||
userAgentString.includes('edge') ||
userAgentString.includes('chrome')
) {

return true;
} else {
return false;
}
}

refreshHardwareLiteBlockMenu() {
Expand Down
171 changes: 124 additions & 47 deletions src/playground/blocks/hardware/block_iCOBOT.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ Entry.iCOBOT.setLanguage = function() {
icobot_motor_135_degrees: "135°",
icobot_motor_150_degrees: "150°",
icobot_motor_180_degrees: "180°",
icobot_motor_210_degrees: "210°",
icobot_motor_225_degrees: "225°",
icobot_motor_240_degrees: "240°",
icobot_motor_270_degrees: "270°",
icobot_motor_300_degrees: "300°",
icobot_motor_315_degrees: "315°",
icobot_motor_330_degrees: "330°",
icobot_motor_360_degrees: "360°",
}
},
en: {
Expand Down Expand Up @@ -314,6 +322,14 @@ Entry.iCOBOT.setLanguage = function() {
icobot_motor_135_degrees: "135°",
icobot_motor_150_degrees: "150°",
icobot_motor_180_degrees: "180°",
icobot_motor_210_degrees: "210°",
icobot_motor_225_degrees: "225°",
icobot_motor_240_degrees: "240°",
icobot_motor_270_degrees: "270°",
icobot_motor_300_degrees: "300°",
icobot_motor_315_degrees: "315°",
icobot_motor_330_degrees: "330°",
icobot_motor_360_degrees: "360°",
}
}
}
Expand Down Expand Up @@ -529,8 +545,8 @@ Entry.iCOBOT.getBlocks = function() {
func: function(sprite, script)
{
var temp = Entry.hw.portData.SENSOR;
var Temperature = temp[9];
var Humidity = (temp[8])/100;
var Temperature = temp[8];
var Humidity = (temp[9])/100;
var Discomfort_index = (((9/5)*Temperature) - (0.55*(1-Humidity)*(((9/5)*Temperature)-26)) + 32);
return Discomfort_index;
},
Expand Down Expand Up @@ -942,6 +958,41 @@ Entry.iCOBOT.getBlocks = function() {
isNotFor: ['iCOBOT'],
events: {},
},

icobot_rgb_list: {
color: EntryStatic.colorSet.block.default.HARDWARE,
outerLine: EntryStatic.colorSet.block.darken.HARDWARE,
fontColor: '#fff',
skeleton: 'basic_string_field',
statements: [],
template: '%1',
params: [
{
type: 'Dropdown',
options: [
[Lang.Blocks.icobot_led_total, '0'],
[Lang.Blocks.icobot_led_left_up, '1'],
[Lang.Blocks.icobot_led_right_up, '2'],
[Lang.Blocks.icobot_led_left_down, '3'],
[Lang.Blocks.icobot_led_right_down, '4'],
],
value: '0',
fontSize: 11,
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
},
],
events: {},
def: {
params: [null],
},
paramsKeyMap: {
PORT: 0,
},
func: function(sprite, script) {
return script.getField('PORT');
},
},

// RGBLED - 종류 선택 및 On/Off
icobot_digital_rgbled_onoff:
Expand All @@ -953,18 +1004,20 @@ Entry.iCOBOT.getBlocks = function() {
statements: [],
params: [
{
type: 'Dropdown',
options: [
[Lang.Blocks.icobot_led_total, '0'],
[Lang.Blocks.icobot_led_left_up, '1'],
[Lang.Blocks.icobot_led_right_up, '2'],
[Lang.Blocks.icobot_led_left_down, '3'],
[Lang.Blocks.icobot_led_right_down, '4'],
],
value: '0',
fontSize: 11,
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
type: 'Block',
accept: 'string',
// type: 'Dropdown',
// options: [
// [Lang.Blocks.icobot_led_total, '0'],
// [Lang.Blocks.icobot_led_left_up, '1'],
// [Lang.Blocks.icobot_led_right_up, '2'],
// [Lang.Blocks.icobot_led_left_down, '3'],
// [Lang.Blocks.icobot_led_right_down, '4'],
// ],
// value: '0',
// fontSize: 11,
// bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
// arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
},
{
type: 'Dropdown',
Expand All @@ -991,7 +1044,12 @@ Entry.iCOBOT.getBlocks = function() {
],
events: {},
def: {
params: [null],
params: [
{
type: 'icobot_rgb_list',
},
null
],
type: 'icobot_digital_rgbled_onoff',
},
paramsKeyMap: {
Expand Down Expand Up @@ -1081,18 +1139,20 @@ Entry.iCOBOT.getBlocks = function() {
statements: [],
params: [
{
type: 'Dropdown',
options: [
[Lang.Blocks.icobot_led_total, '0'],
[Lang.Blocks.icobot_led_left_up, '1'],
[Lang.Blocks.icobot_led_right_up, '2'],
[Lang.Blocks.icobot_led_left_down, '3'],
[Lang.Blocks.icobot_led_right_down, '4'],
],
value: '0',
fontSize: 11,
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
type: 'Block',
accept: 'string',
// type: 'Dropdown',
// options: [
// [Lang.Blocks.icobot_led_total, '0'],
// [Lang.Blocks.icobot_led_left_up, '1'],
// [Lang.Blocks.icobot_led_right_up, '2'],
// [Lang.Blocks.icobot_led_left_down, '3'],
// [Lang.Blocks.icobot_led_right_down, '4'],
// ],
// value: '0',
// fontSize: 11,
// bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
// arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
},
{
type: 'Indicator',
Expand All @@ -1102,7 +1162,12 @@ Entry.iCOBOT.getBlocks = function() {
],
events: {},
def: {
params: [null],
params: [
{
type: 'icobot_rgb_list',
},
null
],
type: 'icobot_digital_rgbled_off',
},
paramsKeyMap: {
Expand Down Expand Up @@ -1167,18 +1232,20 @@ Entry.iCOBOT.getBlocks = function() {
statements: [],
params: [
{
type: 'Dropdown',
options: [
[Lang.Blocks.icobot_led_total, '0'],
[Lang.Blocks.icobot_led_left_up, '1'],
[Lang.Blocks.icobot_led_right_up, '2'],
[Lang.Blocks.icobot_led_left_down, '3'],
[Lang.Blocks.icobot_led_right_down, '4'],
],
value: '0',
fontSize: 11,
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
type: 'Block',
accept: 'string',
// type: 'Dropdown',
// options: [
// [Lang.Blocks.icobot_led_total, '0'],
// [Lang.Blocks.icobot_led_left_up, '1'],
// [Lang.Blocks.icobot_led_right_up, '2'],
// [Lang.Blocks.icobot_led_left_down, '3'],
// [Lang.Blocks.icobot_led_right_down, '4'],
// ],
// value: '0',
// fontSize: 11,
// bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
// arrowColor: EntryStatic.colorSet.arrow.default.HARDWARE,
},
{
type: 'Block',
Expand All @@ -1201,7 +1268,9 @@ Entry.iCOBOT.getBlocks = function() {
events: {},
def: {
params: [
null,
{
type: 'icobot_rgb_list',
},
{
type: 'number',
params: ["0"],
Expand Down Expand Up @@ -1422,13 +1491,21 @@ Entry.iCOBOT.getBlocks = function() {
type: 'Dropdown',
options: [
[Lang.Blocks.icobot_motor_30_degrees, '0'],
[Lang.Blocks.icobot_motor_45_degrees, '1'],
[Lang.Blocks.icobot_motor_45_degrees, '1'],
[Lang.Blocks.icobot_motor_60_degrees, '2'],
[Lang.Blocks.icobot_motor_90_degrees, '3'],
[Lang.Blocks.icobot_motor_120_degrees, '4'],
[Lang.Blocks.icobot_motor_135_degrees, '5'],
[Lang.Blocks.icobot_motor_150_degrees, '6'],
[Lang.Blocks.icobot_motor_180_degrees, '7'],
[Lang.Blocks.icobot_motor_90_degrees, '3'],
[Lang.Blocks.icobot_motor_120_degrees, '4'],
[Lang.Blocks.icobot_motor_135_degrees, '5'],
[Lang.Blocks.icobot_motor_150_degrees, '6'],
[Lang.Blocks.icobot_motor_180_degrees, '7'],
[Lang.Blocks.icobot_motor_210_degrees, '8'],
[Lang.Blocks.icobot_motor_225_degrees, '9'],
[Lang.Blocks.icobot_motor_240_degrees, '10'],
[Lang.Blocks.icobot_motor_270_degrees, '11'],
[Lang.Blocks.icobot_motor_300_degrees, '12'],
[Lang.Blocks.icobot_motor_315_degrees, '13'],
[Lang.Blocks.icobot_motor_330_degrees, '14'],
[Lang.Blocks.icobot_motor_360_degrees, '15'],
],
value: '0',
fontSize: 11,
Expand Down
Loading