From cb554b868572e9540aef9ad1f69c104d0e02c50b Mon Sep 17 00:00:00 2001 From: vivid Date: Wed, 8 Jun 2016 13:30:50 +0900 Subject: [PATCH 1/5] check variable & list name length --- dist/entry.js | 105 +++++++++--------- dist/entry.min.js | 216 +++++++++++++++++++------------------- src/variable_container.js | 23 ++++ 3 files changed, 189 insertions(+), 155 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index f461ced62c..e3d91f713f 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -356,7 +356,7 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_eye_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftEye = e : ("RIGHT" != d && (c.leftEye = e), c.rightEye = e); return a.callReturn(); }; @@ -667,7 +667,7 @@ Blockly.Blocks.albert_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "FRONT" == d ? (c.leftEye = e, c.rightEye = e) : "LEFT" == d ? c.leftEye = e : c.rightEye = e; return a.callReturn(); }; @@ -774,7 +774,7 @@ Entry.block.arduino_get_number = function(b, a) { d.open("POST", "http://localhost:23518/arduino/", !1); d.send(String(c)); Entry.assert(200 == d.status, "arduino is not connected"); - return +d.responseText; + return Number(d.responseText); }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -1639,7 +1639,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() { this.setInputsInline(!0); }}; Entry.block.coordinate_mouse = function(b, a) { - return "x" === a.getField("VALUE", a) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y; + return "x" === a.getField("VALUE", a) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y); }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1663,7 +1663,7 @@ Entry.block.coordinate_object = function(b, a) { var d = c.parent, d = d.pictures; return d.indexOf(c.picture) + 1; case "size": - return +c.getSize().toFixed(1); + return Number(c.getSize().toFixed(1)); case "picture_name": return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name; } @@ -2806,7 +2806,7 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_following_speed_to = function(b, a) { - Entry.hw.sendQueue.lineTracerSpeed = +a.getField("SPEED", a); + Entry.hw.sendQueue.lineTracerSpeed = Number(a.getField("SPEED", a)); return a.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { @@ -2832,7 +2832,7 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftLed = e : ("RIGHT" != d && (c.leftLed = e), c.rightLed = e); return a.callReturn(); }; @@ -3031,7 +3031,7 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_port_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = +a.getField("MODE", a); + var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = Number(a.getField("MODE", a)); "A" == d ? c.ioModeA = e : ("B" != d && (c.ioModeA = e), c.ioModeB = e); return a.callReturn(); }; @@ -3080,7 +3080,7 @@ Blockly.Blocks.is_press_some_key = {init:function() { this.setInputsInline(!0); }}; Entry.block.is_press_some_key = function(b, a) { - var c = +a.getField("VALUE", a); + var c = Number(a.getField("VALUE", a)); return 0 <= Entry.pressedKeys.indexOf(c); }; Blockly.Blocks.reach_something = {init:function() { @@ -3294,13 +3294,13 @@ Entry.block.boolean_basic_operator = function(b, a) { case "EQUAL": return d == e; case "GREATER": - return +d > +e; + return Number(d) > Number(e); case "LESS": - return +d < +e; + return Number(d) < Number(e); case "GREATER_OR_EQUAL": - return +d >= +e; + return Number(d) >= Number(e); case "LESS_OR_EQUAL": - return +d <= +e; + return Number(d) <= Number(e); } }; Blockly.Blocks.show = {init:function() { @@ -3782,7 +3782,7 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { }}; Entry.block.rotate_by_angle_dropdown = function(b, a) { var c = a.getField("VALUE", a); - b.setRotation(b.getRotation() + +c); + b.setRotation(b.getRotation() + Number(c)); return a.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { @@ -3874,8 +3874,8 @@ Blockly.Blocks.locate = {init:function() { Entry.block.locate = function(b, a) { var c = a.getField("VALUE", a), d; "mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY()); - b.setX(+c); - b.setY(+d); + b.setX(Number(c)); + b.setY(Number(d)); b.brush && !b.brush.stop && b.brush.lineTo(c, -1 * d); return a.callReturn(); }; @@ -4071,7 +4071,7 @@ Entry.block.locate_object_time = function(b, a) { if (0 != c) { "mouse" == d ? (d = e.x - b.getX(), e = e.y - b.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - b.getX(), e = e.getY() - b.getY()), a.isStart = !0, a.frameCount = c, a.dX = d / a.frameCount, a.dY = e / a.frameCount; } else { - return "mouse" == d ? (d = +e.x, e = +e.y) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); + return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); } } if (0 != a.frameCount) { @@ -8190,7 +8190,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; g.onblur = function(a) { - isNaN(g.value) || c.entity.setX(+g.value); + isNaN(g.value) || c.entity.setX(Number(g.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8198,7 +8198,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; k.onblur = function(a) { - isNaN(k.value) || c.entity.setY(+k.value); + isNaN(k.value) || c.entity.setY(Number(k.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8206,7 +8206,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; n.onblur = function(a) { - isNaN(n.value) || c.entity.setSize(+n.value); + isNaN(n.value) || c.entity.setSize(Number(n.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8250,7 +8250,7 @@ Entry.EntryObject.prototype.generateView = function() { m.onblur = function(a) { a = m.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setRotation(+a); + isNaN(a) || c.entity.setRotation(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8260,7 +8260,7 @@ Entry.EntryObject.prototype.generateView = function() { q.onblur = function(a) { a = q.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setDirection(+a); + isNaN(a) || c.entity.setDirection(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8332,24 +8332,24 @@ Entry.EntryObject.prototype.generateView = function() { } }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"), m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) { - 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(+a), c.updateRotationView(), m.blur()); + 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur()); }, m.onblur = function(a) { c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); }, q.onkeypress = function(a) { - 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(+a), c.updateRotationView(), q.blur()); + 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur()); }, q.onblur = function(a) { c.entity.setDirection(c.entity.getDirection()); Entry.stage.updateObject(); }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"), h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n), d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(+g.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); }, g.onblur = function(a) { c.entity.setX(c.entity.getX()); Entry.stage.updateObject(); }, k.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(+k.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); }, k.onblur = function(a) { c.entity.setY(c.entity.getY()); Entry.stage.updateObject(); @@ -10284,7 +10284,7 @@ Entry.Parser = function(b, a, c) { this.codeMirror = c; this._lang = a || "js"; this.availableCode = []; - "maze" === b && (this._stageId = +Ntry.configManager.getConfig("stageId"), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); + "maze" === b && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); this.mappingSyntax(b); switch(this._lang) { case "js": @@ -10980,7 +10980,7 @@ p = Entry.Script.prototype; p.init = function(b, a, c) { Entry.assert("BLOCK" == b.tagName.toUpperCase(), b.tagName); this.type = b.getAttribute("type"); - this.id = +b.getAttribute("id"); + this.id = Number(b.getAttribute("id")); b.getElementsByTagName("mutation").length && b.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = b.childNodes[0].getAttribute("hashid")); "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); a instanceof Entry.Script && (this.previousScript = a, a.parentScript && (this.parentScript = a.parentScript)); @@ -11044,7 +11044,7 @@ p.getValue = function(b) { return this.values[b].run(); }; p.getNumberValue = function(b) { - return +this.values[b].run(); + return Number(this.values[b].run()); }; p.getStringValue = function(b) { return String(this.values[b].run()); @@ -11059,7 +11059,7 @@ p.getStringField = function(b) { return String(this.fields[b]); }; p.getNumberField = function(b) { - return +this.fields[b]; + return Number(this.fields[b]); }; p.callReturn = function() { return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; @@ -12007,7 +12007,7 @@ Entry.getElementsByClassName = function(b) { return a; }; Entry.parseNumber = function(b) { - return "string" != typeof b || isNaN(+b) ? "number" != typeof b || isNaN(+b) ? !1 : b : +b; + return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b); }; Entry.countStringLength = function(b) { var a, c = 0; @@ -12073,7 +12073,7 @@ Entry.computeInputWidth = function(b) { document.body.appendChild(a); b = a.offsetWidth; document.body.removeChild(a); - return +(b + 10) + "px"; + return Number(b + 10) + "px"; }; Entry.isArrowOrBackspace = function(b) { return -1 < [37, 38, 39, 40, 8].indexOf(b); @@ -12238,7 +12238,7 @@ Entry.getMaxFloatPoint = function(b) { return Math.min(a, 20); }; Entry.convertToRoundedDecimals = function(b, a) { - return isNaN(b) || !this.isFloat(b) ? b : +(Math.round(b + "e" + a) + "e-" + a); + return isNaN(b) || !this.isFloat(b) ? b : Number(Math.round(b + "e" + a) + "e-" + a); }; Entry.attachEventListener = function(b, a, c) { setTimeout(function() { @@ -12597,7 +12597,7 @@ Entry.Func.generateBlock = function(b) { var a = {template:b.template, params:b.params}, c = /(%\d)/mi, d = b.template.split(c), e = "", f = 0, g = 0, h; for (h in d) { var k = d[h]; - c.test(k) ? (k = +k.split("%")[1] - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; + c.test(k) ? (k = Number(k.split("%")[1]) - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; } return {block:a, description:e}; }; @@ -12990,7 +12990,7 @@ p.removePortReadable = function(b) { var a, c; for (c in this.sendQueue.readablePorts) { if (this.sendQueue.readablePorts[c] == b) { - a = +c; + a = Number(c); break; } } @@ -13056,7 +13056,7 @@ Entry.Variable = function(b) { this.isCloud_ = b.isCloud || !1; var a = Entry.parseNumber(b.value); this.value_ = "number" == typeof a ? a : b.value ? b.value : 0; - "slide" == this.type && (this.minValue_ = +(b.minValue ? b.minValue : 0), this.maxValue_ = +(b.maxValue ? b.maxValue : 100)); + "slide" == this.type && (this.minValue_ = Number(b.minValue ? b.minValue : 0), this.maxValue_ = Number(b.maxValue ? b.maxValue : 100)); b.isClone || (this.visible_ = b.visible || "boolean" == typeof b.visible ? b.visible : !0, this.x_ = b.x ? b.x : null, this.y_ = b.y ? b.y : null, "list" == this.type && (this.width_ = b.width ? b.width : 100, this.height_ = b.height ? b.height : 120, this.array_ = b.array ? b.array : [], this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); }; Entry.Variable.prototype.generateView = function(b) { @@ -13225,13 +13225,13 @@ Entry.Variable.prototype.getId = function() { return this.id_; }; Entry.Variable.prototype.getValue = function() { - return this.isNumber() ? +this.value_ : this.value_; + return this.isNumber() ? Number(this.value_) : this.value_; }; Entry.Variable.prototype.isNumber = function() { return isNaN(this.value_) ? !1 : !0; }; Entry.Variable.prototype.setValue = function(b) { - "slide" != this.type ? this.value_ = b : (b = +b, this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); + "slide" != this.type ? this.value_ = b : (b = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); this.isCloud_ && Entry.variableContainer.updateCloudVariables(); this.updateView(); }; @@ -13333,7 +13333,7 @@ Entry.Variable.prototype.updateSlideValueByView = function() { var b = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; 0 > b && (b = 0); 1 < b && (b = 1); - var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Math.abs(c - a) * b).toFixed(2), b = parseFloat(b); + var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Number(Math.abs(c - a) * b)).toFixed(2), b = parseFloat(b); b < a ? b = this.minValue_ : b > c && (b = this.maxValue_); this.isFloatPoint() || (b = Math.round(b)); this.setValue(b); @@ -13765,6 +13765,7 @@ Entry.VariableContainer.prototype.addVariable = function(b) { var a = this.variableAddPanel; b = a.view.name.value.trim(); b && 0 !== b.length || (b = Lang.Workspace.variable); + b.length > this._maxNameLength && (b = this._truncName(b, "variable")); b = this.checkAllVariableName(b, "variables_") ? Entry.getOrderedName(b, this.variables_, "name_") : b; var c = a.info; b = {name:b, isCloud:c.isCloud, object:c.object, variableType:"variable"}; @@ -13943,6 +13944,7 @@ Entry.VariableContainer.prototype.addList = function(b) { b = a.view.name.value.trim(); b && 0 !== b.length || (b = Lang.Workspace.list); var c = a.info; + b.length > this._maxNameLength && (b = this._truncName(b, "list")); b = this.checkAllVariableName(b, "lists_") ? Entry.getOrderedName(b, this.lists_, "name_") : b; b = {name:b, isCloud:c.isCloud, object:c.object, variableType:"list"}; a.view.addClass("entryRemove"); @@ -14521,7 +14523,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) { c.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.setListLength = function(b) { - b = +b; + b = Number(b); var a = this.selectedList.array_; if (!isNaN(b)) { var c = a.length; @@ -14617,6 +14619,13 @@ Entry.VariableContainer.prototype.removeRef = function(b, a) { Entry.VariableContainer.prototype._getBlockMenu = function() { return Entry.playground.mainWorkspace.getBlockMenu(); }; +Entry.VariableContainer.prototype._truncName = function(b, a) { + b = b.substring(0, this._maxNameLength); + str = "variable" == a ? "\ubcc0\uc218" : "\ub9ac\uc2a4\ud2b8"; + Entry.toast.warning("%1 \uc774\ub984 \uc790\ub3d9 \ubcc0\uacbd".replace("%1", str), "%1\uc758 \uc774\ub984\uc740 10\uae00\uc790\ub97c \ub118\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.".replace("%1", str)); + return b; +}; +Entry.VariableContainer.prototype._maxNameLength = 10; Entry.block.run = {skeleton:"basic", color:"#3BBD70", contents:["this is", "basic block"], func:function() { }}; Entry.block.mutant = {skeleton:"basic", event:"start", color:"#3BBD70", template:"test mutant block", params:[], func:function() { @@ -15306,7 +15315,7 @@ Entry.BlockMenu = function(b, a, c, d) { if (isNaN(a)) { return a; } - a = +a; + a = Number(a); for (var b = this._categories, d = this._categoryElems, e = 0;e < b.length;e++) { var f = b[e]; if (!d[f].hasClass("entryRemove") && 0 === a--) { @@ -15668,7 +15677,7 @@ Entry.BlockView.DRAG_RADIUS = 5; var h = e[g].trim(); if (0 !== h.length) { if (d.test(h)) { - var k = +h.split("%")[1] - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); + var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); this._contents.push(h); this._paramMap[k] = h; } else { @@ -16418,10 +16427,10 @@ Entry.Scope = function(b, a) { return String(this.getValue(a, b)); }; b.getNumberValue = function(a, b) { - return +this.getValue(a); + return Number(this.getValue(a)); }; b.getBooleanValue = function(a, b) { - return +this.getValue(a, b) ? !0 : !1; + return Number(this.getValue(a, b)) ? !0 : !1; }; b.getField = function(a, b) { return this.block.params[this._getParamIndex(a)]; @@ -16430,7 +16439,7 @@ Entry.Scope = function(b, a) { return String(this.getField(a)); }; b.getNumberField = function(a) { - return +this.getField(a); + return Number(this.getField(a)); }; b.getStatement = function(a, b) { return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); @@ -19095,7 +19104,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; return this.mode; }; b.setMode = function(a, b) { - a = +a; + a = Number(a); var d = this.mode; this.mode = a; switch(a) { @@ -20134,7 +20143,7 @@ Entry.Xml.getNumberValue = function(b, a, c) { } for (var d in c) { if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == a) { - return +Entry.Xml.operate(b, c[d].children[0]); + return Number(Entry.Xml.operate(b, c[d].children[0])); } } return null; @@ -20157,7 +20166,7 @@ Entry.Xml.getNumberField = function(b, a) { } for (var d in c) { if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return +c[d].textContent; + return Number(c[d].textContent); } } }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 6ac2d63c65..46b2b05474 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -32,7 +32,7 @@ Blockly.Blocks.albert_stop={init:function(){this.setColour("#00979D");this.appen Blockly.Blocks.albert_set_pad_size_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_1);this.appendValueInput("WIDTH").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_2);this.appendValueInput("HEIGHT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_pad_size_to=function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; Blockly.Blocks.albert_clear_eye={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_eye_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_eye=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}; Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.turn_on,"ON"],[Lang.General.turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_body_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -62,7 +62,7 @@ Entry.block.albert_move_backward=function(b,a){var c=Entry.hw.sendQueue;if(a.isS Blockly.Blocks.albert_turn_around={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_around_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_around_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_turn_around=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a);a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}; Blockly.Blocks.albert_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.General.skyblue,"3"],[Lang.General.blue,"1"],[Lang.General.purple, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; Blockly.Blocks.albert_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}; Blockly.Blocks.albert_change_wheels_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_change_wheels_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ @@ -76,7 +76,7 @@ Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entr Blockly.Blocks.arduino_send={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_2);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.arduino_send=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}; Blockly.Blocks.arduino_get_string={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_2);this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}; +Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}; Blockly.Blocks.arduino_get_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.arduino_get_string=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}; Blockly.Blocks.arduino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_arduino_get_sensor_number_0,"A0"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_1,"A1"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_2,"A2"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_3,"A3"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_4,"A4"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_5,"A5"]]),"PORT");this.appendDummyInput().appendField(" "); @@ -181,10 +181,10 @@ Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockC Entry.block.get_rotation_direction=function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.distance_something={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_distance_something_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_distance_something_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.distance_something=function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}; -Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; Blockly.Blocks.calc_basic={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["String","Number"]);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_basic=function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_plus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; @@ -304,10 +304,10 @@ Blockly.Blocks.hamster_follow_line_until={init:function(){this.setColour("#00979 Entry.block.hamster_follow_line_until=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, g);return a}; Blockly.Blocks.hamster_set_following_speed_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_following_speed_to_1).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]]),"SPEED").appendField(Lang.Blocks.HAMSTER_set_following_speed_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED",a);return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED",a));return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_stop=function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}; Blockly.Blocks.hamster_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"], -[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; Blockly.Blocks.hamster_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()};Blockly.Blocks.hamster_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_beep=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}; @@ -328,12 +328,12 @@ Entry.block.hamster_change_tempo_by=function(b,a){Entry.Hamster.tempo+=a.getNumb Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_port_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_port_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_port_to_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"], -[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=Number(a.getField("MODE",a));"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; Blockly.Blocks.hamster_change_output_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_change_output_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}; Blockly.Blocks.hamster_set_output_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_output_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; -Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(c)}; Blockly.Blocks.reach_something={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("collision"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.reach_something=function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE",a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"== c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; +Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_hide).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hide=function(b,a){b.setVisible(!1);return a.callReturn()}; Blockly.Blocks.dialog_time={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_2);this.appendValueInput("SECOND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_3);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION"); this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -400,7 +400,7 @@ Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_by_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}; Blockly.Blocks.rotate_by_angle_dropdown={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["45","45"],["90","90"],["135","135"],["180","180"]]),"VALUE").appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}; Blockly.Blocks.see_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.see_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.see_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -412,7 +412,7 @@ Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b Blockly.Blocks.locate_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.locate_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; +Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; Blockly.Blocks.move_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.move_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; @@ -438,8 +438,8 @@ Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this. Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.locate_object_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&& +!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}; Blockly.Blocks.rotate_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -825,25 +825,26 @@ d.object=this;this.editView_=d;this.view_.appendChild(d);Entry.objectEditable?($ d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)}));d=Entry.createElement("div");d.addClass("entryObjectInformationWorkspace");d.object=this;this.isInformationToggle=!1;b.appendChild(d);this.informationView_=d;b=Entry.createElement("div");b.addClass("entryObjectRotationWrapperWorkspace");b.object=this;this.view_.appendChild(b);d=Entry.createElement("span");d.addClass("entryObjectCoordinateWorkspace"); b.appendChild(d);e=Entry.createElement("span");e.addClass("entryObjectCoordinateSpanWorkspace");e.innerHTML="X:";var g=Entry.createElement("input");g.addClass("entryObjectCoordinateInputWorkspace");g.setAttribute("readonly",!0);g.bindOnClick(function(a){a.stopPropagation();this.select()});var h=Entry.createElement("span");h.addClass("entryObjectCoordinateSpanWorkspace");h.innerHTML="Y:";var k=Entry.createElement("input");k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); k.bindOnClick(function(a){a.stopPropagation();this.select()});k.setAttribute("readonly",!0);var l=Entry.createElement("span");l.addClass("entryObjectCoordinateSizeWorkspace");l.innerHTML=Lang.Workspace.Size+" : ";var n=Entry.createElement("input");n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size");n.bindOnClick(function(a){a.stopPropagation();this.select()});n.setAttribute("readonly",!0);d.appendChild(e);d.appendChild(g);d.appendChild(h);d.appendChild(k); -d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(+g.value);c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(+k.value);c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)}; -n.onblur=function(a){isNaN(n.value)||c.entity.setSize(+n.value);c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly",!0);m.bindOnClick(function(a){a.stopPropagation(); -this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_=m;d.directionInput_=q;c=this;m.onkeypress=function(a){13== -a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(+a);c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(+a);c.updateRotationView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper"); -b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))}); -b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b); -b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id),b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&& -Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])),this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"), -d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"),b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this, -this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)})),d=Entry.createElement("button"), -d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"),this.view_.appendChild(d),this.rotateLabelWrapperView_= -d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_=q,d.appendChild(e),d.appendChild(m),d.appendChild(h), -d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(+a),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setDirection(+a),c.updateRotationView(), -q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"),g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"), -h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"),d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l), -d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(+g.value),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(+k.value),c.updateCoordinateView(),c.blur())},k.onblur=function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"), -d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"), -b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}), -this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b};Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; +d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(Number(g.value));c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(Number(k.value));c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13== +a.keyCode&&c.editObjectValues(!1)};n.onblur=function(a){isNaN(n.value)||c.entity.setSize(Number(n.value));c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly", +!0);m.bindOnClick(function(a){a.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_= +m;d.directionInput_=q;c=this;m.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(Number(a));c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(Number(a));c.updateRotationView(); +Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper");b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")|| +this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace"); +b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id), +b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&&Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])), +this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"),d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"), +b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this,this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")|| +Entry.container.removeObject(this.object)})),d=Entry.createElement("button"),d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"), +this.view_.appendChild(d),this.rotateLabelWrapperView_=d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_= +q,d.appendChild(e),d.appendChild(m),d.appendChild(h),d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(Number(a)),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))), +isNaN(a)||c.entity.setDirection(Number(a)),c.updateRotationView(),q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"), +g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"),h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"), +d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l),d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(Number(g.value)),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(Number(k.value)),c.updateCoordinateView(),c.blur())},k.onblur= +function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"),d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b), +b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_= +b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}),this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b}; +Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; Entry.EntryObject.prototype.initEntity=function(b){var a={};a.x=a.y=0;a.rotation=0;a.direction=90;if("sprite"==this.objectType){var c=b.sprite.pictures[0].dimension;a.regX=c.width/2;a.regY=c.height/2;a.scaleX=a.scaleY="background"==b.sprite.category.main?Math.max(270/c.height,480/c.width):"new"==b.sprite.category.main?1:200/(c.width+c.height);a.width=c.width;a.height=c.height}else if("textBox"==this.objectType)if(a.regX=25,a.regY=12,a.scaleX=a.scaleY=1.5,a.width=50,a.height=24,a.text=b.text,b.options){if(b= b.options,c="",b.bold&&(c+="bold "),b.italic&&(c+="italic "),a.underline=b.underline,a.strike=b.strike,a.font=c+"20px "+b.font.family,a.colour=b.colour,a.bgColor=b.background,a.lineBreak=b.lineBreak)a.width=256,a.height=.5625*a.width,a.regX=a.width/2,a.regY=a.height/2}else a.underline=!1,a.strike=!1,a.font="20px Nanum Gothic",a.colour="#000000",a.bgColor="#ffffff";return a}; Entry.EntryObject.prototype.updateThumbnailView=function(){if("sprite"==this.objectType)if(this.entity.picture.fileurl)this.thumbnailView_.style.backgroundImage='url("'+this.entity.picture.fileurl+'")';else{var b=this.entity.picture.filename;this.thumbnailView_.style.backgroundImage='url("'+Entry.defaultPath+"/uploads/"+b.substring(0,2)+"/"+b.substring(2,4)+"/thumb/"+b+'.png")'}else"textBox"==this.objectType&&(this.thumbnailView_.style.backgroundImage="url("+(Entry.mediaFilePath+"/text_icon.png")+ @@ -1004,7 +1005,7 @@ node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294 node:a};};b.initScope=function(a){if(null===this.scope){var b=function(){};b.prototype=this.syntax.Scope}else b=function(){},b.prototype=this.scope;this.scope=new b;this.scopeChain.push(this.scope);return this.scanDefinition(a)};b.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};b.scanDefinition=function(a){a=a.body;for(var b=[],d=0;d=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; (function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var d=acorn.parse(a),b=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,c){var d="";1===c&&(a+="\n");d=-1=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"), $(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; -p.init=function(b,a,c){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=+b.getAttribute("id");b.getElementsByTagName("mutation").length&&b.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=b.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);a instanceof Entry.Script&&(this.previousScript=a,a.parentScript&&(this.parentScript=a.parentScript));c instanceof Entry.Script&&(this.parentScript= -c);b=b.childNodes;for(a=0;a=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,c){return"#"+(16777216+(b<<16)+(a<<8)+c).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,c){return b>c?c:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; -Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return+(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;c/g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cd&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:+(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; +Entry.getMaxFloatPoint=function(b){for(var a=0,c=0,d=b.length;ca&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function c(){}c.prototype=b.prototype;a.prototype=new c;return a}; Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id:"entryTrashcanFilter_"+a});d.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});d.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});d=d.elem("feMerge");d.elem("feMergeNode",{"in":"offsetBlur"});d.elem("feMergeNode",{"in":"SourceGraphic"},d);d=c.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});d.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});d.elem("feColorMatrix", @@ -1168,7 +1169,7 @@ Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.me Entry.Func.requestParamBlock=function(b){var a=Entry.generateHash(),c;switch(b){case "string":c=Entry.block.function_param_string;break;case "boolean":c=Entry.block.function_param_boolean;break;default:return null}a=b+"Param_"+a;b=Entry.Func.createParamBlock(a,c,b);Entry.block[a]=b;return a}; Entry.Func.registerParamBlock=function(b){-1=Entry.HW.TRIAL_LIMIT)this.isFi JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)}.bind(this),a.onclose=function(){"WebSocket"===b.socketType&&(this.socket=null,b.initSocket())}}catch(d){}try{c=new WebSocket("wss://hardware.play-entry.org:23518")}catch(d){}}c.binaryType="arraybuffer";c.onopen=function(){b.socketType="WebSocketSecurity";b.initHardware(c)};c.onmessage=function(a){a=JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)};c.onclose=function(){"WebSocketSecurity"===b.socketType&&(this.socket=null,b.initSocket())}; Entry.dispatchEvent("hwChanged")}}catch(d){}};p.retryConnect=function(){this.connectTrial=0;this.initSocket()};p.initHardware=function(b){this.socket=b;this.connectTrial=0;this.connected=!0;Entry.dispatchEvent("hwChanged");Entry.playground&&Entry.playground.object&&Entry.playground.setMenu(Entry.playground.object.objectType)};p.setDigitalPortValue=function(b,a){this.sendQueue[b]=a;this.removePortReadable(b)};p.getAnalogPortValue=function(b){return this.connected?this.portData["a"+b]:0}; p.getDigitalPortValue=function(b){if(!this.connected)return 0;this.setPortReadable(b);return void 0!==this.portData[b]?this.portData[b]:0};p.setPortReadable=function(b){this.sendQueue.readablePorts||(this.sendQueue.readablePorts=[]);var a=!1,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=!0;break}a||this.sendQueue.readablePorts.push(b)}; -p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=+c;break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; +p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=Number(c);break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; p.updatePortData=function(b){this.portData=b;this.hwMonitor&&this.hwMonitor.update()};p.closeConnection=function(){this.socket&&this.socket.close()};p.downloadConnector=function(){window.open("http://download.play-entry.org/apps/Entry_HW_1.5.3_Setup.exe","_blank").focus()};p.downloadSource=function(){window.open("http://play-entry.com/down/board.ino","_blank").focus()};p.setZero=function(){Entry.hw.hwModule&&Entry.hw.hwModule.setZero()}; p.checkDevice=function(b){void 0!==b.company&&(b=""+b.company+b.model,b!=this.selectedDevice&&(this.selectedDevice=b,this.hwModule=this.hwInfo[b],Entry.dispatchEvent("hwChanged"),Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5","\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.",!0),this.hwModule.monitorTemplate&&(this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule, -this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=+(b.minValue?b.minValue:0),this.maxValue_=+(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"==typeof b.visible? -b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=Number(b.minValue?b.minValue:0),this.maxValue_=Number(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"== +typeof b.visible?b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(b){var a=this.type;if("variable"==a||"timer"==a||"answer"==a)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",a=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", function(a){"workspace"==Entry.type&&(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==a){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= @@ -1220,15 +1221,15 @@ this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredW this.scrollPosition+b&&ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ 14,this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+ 15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1, -2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?+this.value_:this.value_}; -Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=+b,this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_}; +Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");(this.visible_=this.view_.visible=b)&&this.updateView()};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs(this.value_-a)/Math.abs(this.maxValue_-a)*b+10}; Entry.Variable.prototype.setSlideCommandX=function(b){var a=this.valueSetter_.graphics.command;b=Math.max("undefined"==typeof b?10:b,10);b=Math.min(this.maxWidth+10,b);a.x=b;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; Entry.Variable.prototype.setMinValue=function(b){this.minValue_=b;this.value_b&&(this.value_=b);this.updateView();this.isMaxFloat=Entry.isFloat(this.maxValue_)};Entry.Variable.prototype.isFloatPoint=function(){return this.isMaxFloat||this.isMinFloat};Entry.VariableContainer=function(){this.variables_=[];this.messages_=[];this.lists_=[];this.functions_={};this.viewMode_="all";this.selected=null;this.variableAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.listAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.selectedVariable=null;this._variableRefs=[];this._messageRefs=[];this._functionRefs=[]}; Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; @@ -1265,8 +1266,8 @@ Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[] Entry.VariableContainer.prototype.createFunctionView=function(b){var a=this;if(this.view_){var c=Entry.createElement("li");c.addClass("entryVariableListElementWorkspace");c.addClass("entryFunctionElementWorkspace");c.bindOnClick(function(c){c.stopPropagation();a.select(b)});var d=Entry.createElement("button");d.addClass("entryVariableListElementDeleteWorkspace");d.bindOnClick(function(c){c.stopPropagation();a.removeFunction(b);a.selected=null});var e=Entry.createElement("button");e.addClass("entryVariableListElementEditWorkspace"); var f=this._getBlockMenu();e.bindOnClick(function(a){a.stopPropagation();Entry.Func.edit(b);Entry.playground&&(Entry.playground.changeViewMode("code"),"func"!=f.lastSelector&&f.selectMenu("func"))});var g=Entry.createElement("div");g.addClass("entryVariableFunctionElementNameWorkspace");g.innerHTML=b.description;c.nameField=g;c.appendChild(g);c.appendChild(e);c.appendChild(d);b.listElement=c}}; Entry.VariableContainer.prototype.checkAllVariableName=function(b,a){a=this[a];for(var c=0;cthis._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var c=a.info;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& +Entry.stateManager.addCommand("add variable",this,this.removeVariable,b);b.generateView(this.variables_.length);this.createVariableView(b);this.variables_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,b)}; Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),c=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; Entry.VariableContainer.prototype.changeVariableName=function(b,a){b.name_!=a&&(Entry.isExist(a,"name_",this.variables_)?(b.listElement.nameField.value=b.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", +this,this.removeList,b);b.generateView(this.lists_.length);this.createListView(b);this.lists_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,b)}; Entry.VariableContainer.prototype.createListView=function(b){var a=this,c=Entry.createElement("li"),d=Entry.createElement("div");d.addClass("entryVariableListElementWrapperWorkspace");c.appendChild(d);c.addClass("entryVariableListElementWorkspace");b.object_?c.addClass("entryListLocalElementWorkspace"):b.isCloud_?c.addClass("entryListCloudElementWorkspace"):c.addClass("entryListGlobalElementWorkspace");c.bindOnClick(function(c){a.select(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); e.bindOnClick(function(c){c.stopPropagation();a.removeList(b);a.selectedList=null;a.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.select(b);a.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?a.changeListName(b,this.value):(Entry.toast.alert(Lang.Msgs.warn, @@ -1326,14 +1327,15 @@ c=Entry.createElement("div");c.addClass("entryListSettingLengthControllerWorkspa d=Entry.createElement("span");d.addClass("entryListSettingPlusWorkspace");d.bindOnClick(function(a){b.selectedList.array_.push({data:0});b.updateListSettingView(b.selectedList)});c.appendChild(d);c=Entry.createElement("div");a.seperator=c;a.appendChild(c);c.addClass("entryListSettingSeperatorWorkspace");c=Entry.createElement("div");c.addClass("entryListSettingListValuesWorkspace");a.listValues=c;a.appendChild(c)}; Entry.VariableContainer.prototype.updateListSettingView=function(b){var a=this;b=b||this.selectedList;var c=this.listSettingView,d=c.listValues,e=c.visibleCheck,f=c.lengthInput,g=c.seperator;e.removeClass("entryListSettingCheckedWorkspace");b.isVisible()&&e.addClass("entryListSettingCheckedWorkspace");f.value=b.array_.length;for(b.listElement.appendChild(c);d.firstChild;)d.removeChild(d.firstChild);var h=b.array_;0===h.length?g.addClass("entryRemove"):g.removeClass("entryRemove");for(e=0;eb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +f.addClass("entryListSettingValueRemoveWorkspace");e.appendChild(f);d.appendChild(e)})(e);b.updateView();c.removeClass("entryRemove")};Entry.VariableContainer.prototype.setListLength=function(b){b=Number(b);var a=this.selectedList.array_;if(!isNaN(b)){var c=a.length;if(cb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; Entry.VariableContainer.prototype.addRef=function(b,a){if(this.view_&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:a.getCode().object,block:a};a.funcBlock&&(c.funcBlock=a.funcBlock,delete a.funcBlock);this[b].push(c);if("_functionRefs"==b)for(var d=a.type.substr(5),e=Entry.variableContainer.functions_[d].content.getBlockList(),f=0;fc))throw Error("x range exceeded");d.indexOf("_")&&(d=d.split("_")[0]);-1<["sin","cos","tan"].indexOf(d)&&(c=Entry.toRadian(c));var e=0;switch(d){case "square":e=c*c;break;case "factorial":e=Entry.factorial(c);break; case "root":e=Math.sqrt(c);break;case "log":e=Math.log(c)/Math.LN10;break;case "ln":e=Math.log(c);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[d](c));break;case "unnatural":e=c-Math.floor(c);0>c&&(e=1-e);break;default:e=Math[d](c)}return Math.round(1E3*e)/1E3}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2, @@ -1556,11 +1558,11 @@ e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e) {type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_using"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("COLOR"),e=a.getField("DIRECTION"),f=1;"RIGHT"==e?f=2:"BOTH"==e&&(f=3);"WHITE"==d&&(f+=7);c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,f);return a.callReturn()}},hamster_follow_line_until:{color:"#00979D",skeleton:"basic", statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_black,"BLACK"],[Lang.General.white,"WHITE"]],value:"BLACK",fontSize:11},{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.Blocks.HAMSTER_front,"FRONT"],[Lang.Blocks.HAMSTER_rear,"REAR"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_until"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel", isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, -g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED", -a);return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, +g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED", +a));return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, "LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_led_to"},paramsKeyMap:{DIRECTION:0,COLOR:1}, -"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], +"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}},hamster_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"hamster_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getNumberValue("VALUE");c.buzzer=void 0!=c.buzzer?c.buzzer+d:d;c.note=0;return a.callReturn()}},hamster_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", params:["1000"]},null],type:"hamster_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.buzzer=a.getNumberValue("VALUE");c.note=0;return a.callReturn()}},hamster_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_clear_buzzer"},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c= @@ -1571,16 +1573,16 @@ hamster_rest_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:" 1;var d=a.getNumberValue("VALUE"),d=6E4*d/Entry.Hamster.tempo;c.buzzer=0;c.note=0;var e=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(e)},d);Entry.Hamster.timeouts.push(e);return a}},hamster_change_tempo_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["20"]},null],type:"hamster_change_tempo_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer", isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo+=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo= a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"], -[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}},hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE"); -"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()}},is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"}, -"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2,color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}},reach_something:{color:"#AEB8FF", -skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE", -a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"==c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y); -c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a); -return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND", +a);return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d}},boolean_smaller:{color:"#AEB8FF", skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text", params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}], -paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null], -type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown", -options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart= -!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS}, -{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}},remove_dialog:{color:"#EC4466",skeleton:"basic", -statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"}, -paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&& -(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect", -isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect", -isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* +paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a), +d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]], +value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}}, +remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, +null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png", +size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity, +"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness: +"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0, +VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"}, +"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* c);return a.callReturn()}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}},change_scale_size:{color:"#EC4466", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}},flip_x:{color:"#EC4466", @@ -1622,13 +1624,13 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",p img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY(); c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b,a){var c= -a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", +a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[], params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_x:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, {type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", +{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator", img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()- @@ -1642,10 +1644,10 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type: d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation(); b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},locate_object_time:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE", -a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+ -a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c); -return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, +a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX), +b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", +a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[], +params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0, VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3", @@ -1874,7 +1876,7 @@ b.getMode())&&Entry.GlobalSvg.addControl(a);else if(g.code&&(b=e.block,d=b.getTh this._boardBlockView;if(a){this.workspace.getBoard();this._boardBlockView=null;var b=Entry.GlobalSvg.left,d=Entry.GlobalSvg.width/2,a=a.getBoard().offset().left;return bthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1 this._maxNameLength) + name = this._truncName(name, 'variable'); + name = this.checkAllVariableName(name,'variables_') ? Entry.getOrderedName(name, this.variables_, 'name_') : name; var info = panel.info; variable = { @@ -1162,6 +1166,10 @@ Entry.VariableContainer.prototype.addList = function(list) { name = Lang.Workspace.list; var info = panel.info; + + if (name.length > this._maxNameLength) + name = this._truncName(name, 'list'); + name = this.checkAllVariableName(name, 'lists_') ? Entry.getOrderedName(name, this.lists_, 'name_') : name; list = { name: name, @@ -2277,3 +2285,18 @@ Entry.VariableContainer.prototype.removeRef = function(type, block) { Entry.VariableContainer.prototype._getBlockMenu = function() { return Entry.playground.mainWorkspace.getBlockMenu(); }; + +Entry.VariableContainer.prototype._truncName = function(name, type) { + name = name.substring(0, this._maxNameLength); + if (type == 'variable') str = '변수'; + else str = '리스트'; + + Entry.toast.warning( + '%1 이름 자동 변경'.replace('%1', str), + '%1의 이름은 10글자를 넘을 수 없습니다.'.replace('%1', str) + ); + + return name; +}; + +Entry.VariableContainer.prototype._maxNameLength = 10; From 9a48b649701b80fb70be2e972cf0dfab917caaaa Mon Sep 17 00:00:00 2001 From: vivid Date: Wed, 8 Jun 2016 15:51:35 +0900 Subject: [PATCH 2/5] fix dropdown invisible bug --- dist/entry.js | 108 ++++++++--------- dist/entry.min.js | 209 ++++++++++++++++---------------- src/workspace/field/dropdown.js | 31 +++-- 3 files changed, 178 insertions(+), 170 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index f461ced62c..0686392dfb 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -356,7 +356,7 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_eye_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftEye = e : ("RIGHT" != d && (c.leftEye = e), c.rightEye = e); return a.callReturn(); }; @@ -667,7 +667,7 @@ Blockly.Blocks.albert_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "FRONT" == d ? (c.leftEye = e, c.rightEye = e) : "LEFT" == d ? c.leftEye = e : c.rightEye = e; return a.callReturn(); }; @@ -774,7 +774,7 @@ Entry.block.arduino_get_number = function(b, a) { d.open("POST", "http://localhost:23518/arduino/", !1); d.send(String(c)); Entry.assert(200 == d.status, "arduino is not connected"); - return +d.responseText; + return Number(d.responseText); }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -1639,7 +1639,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() { this.setInputsInline(!0); }}; Entry.block.coordinate_mouse = function(b, a) { - return "x" === a.getField("VALUE", a) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y; + return "x" === a.getField("VALUE", a) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y); }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1663,7 +1663,7 @@ Entry.block.coordinate_object = function(b, a) { var d = c.parent, d = d.pictures; return d.indexOf(c.picture) + 1; case "size": - return +c.getSize().toFixed(1); + return Number(c.getSize().toFixed(1)); case "picture_name": return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name; } @@ -2806,7 +2806,7 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_following_speed_to = function(b, a) { - Entry.hw.sendQueue.lineTracerSpeed = +a.getField("SPEED", a); + Entry.hw.sendQueue.lineTracerSpeed = Number(a.getField("SPEED", a)); return a.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { @@ -2832,7 +2832,7 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftLed = e : ("RIGHT" != d && (c.leftLed = e), c.rightLed = e); return a.callReturn(); }; @@ -3031,7 +3031,7 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_port_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = +a.getField("MODE", a); + var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = Number(a.getField("MODE", a)); "A" == d ? c.ioModeA = e : ("B" != d && (c.ioModeA = e), c.ioModeB = e); return a.callReturn(); }; @@ -3080,7 +3080,7 @@ Blockly.Blocks.is_press_some_key = {init:function() { this.setInputsInline(!0); }}; Entry.block.is_press_some_key = function(b, a) { - var c = +a.getField("VALUE", a); + var c = Number(a.getField("VALUE", a)); return 0 <= Entry.pressedKeys.indexOf(c); }; Blockly.Blocks.reach_something = {init:function() { @@ -3294,13 +3294,13 @@ Entry.block.boolean_basic_operator = function(b, a) { case "EQUAL": return d == e; case "GREATER": - return +d > +e; + return Number(d) > Number(e); case "LESS": - return +d < +e; + return Number(d) < Number(e); case "GREATER_OR_EQUAL": - return +d >= +e; + return Number(d) >= Number(e); case "LESS_OR_EQUAL": - return +d <= +e; + return Number(d) <= Number(e); } }; Blockly.Blocks.show = {init:function() { @@ -3782,7 +3782,7 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { }}; Entry.block.rotate_by_angle_dropdown = function(b, a) { var c = a.getField("VALUE", a); - b.setRotation(b.getRotation() + +c); + b.setRotation(b.getRotation() + Number(c)); return a.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { @@ -3874,8 +3874,8 @@ Blockly.Blocks.locate = {init:function() { Entry.block.locate = function(b, a) { var c = a.getField("VALUE", a), d; "mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY()); - b.setX(+c); - b.setY(+d); + b.setX(Number(c)); + b.setY(Number(d)); b.brush && !b.brush.stop && b.brush.lineTo(c, -1 * d); return a.callReturn(); }; @@ -4071,7 +4071,7 @@ Entry.block.locate_object_time = function(b, a) { if (0 != c) { "mouse" == d ? (d = e.x - b.getX(), e = e.y - b.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - b.getX(), e = e.getY() - b.getY()), a.isStart = !0, a.frameCount = c, a.dX = d / a.frameCount, a.dY = e / a.frameCount; } else { - return "mouse" == d ? (d = +e.x, e = +e.y) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); + return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); } } if (0 != a.frameCount) { @@ -8190,7 +8190,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; g.onblur = function(a) { - isNaN(g.value) || c.entity.setX(+g.value); + isNaN(g.value) || c.entity.setX(Number(g.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8198,7 +8198,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; k.onblur = function(a) { - isNaN(k.value) || c.entity.setY(+k.value); + isNaN(k.value) || c.entity.setY(Number(k.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8206,7 +8206,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; n.onblur = function(a) { - isNaN(n.value) || c.entity.setSize(+n.value); + isNaN(n.value) || c.entity.setSize(Number(n.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8250,7 +8250,7 @@ Entry.EntryObject.prototype.generateView = function() { m.onblur = function(a) { a = m.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setRotation(+a); + isNaN(a) || c.entity.setRotation(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8260,7 +8260,7 @@ Entry.EntryObject.prototype.generateView = function() { q.onblur = function(a) { a = q.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setDirection(+a); + isNaN(a) || c.entity.setDirection(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8332,24 +8332,24 @@ Entry.EntryObject.prototype.generateView = function() { } }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"), m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) { - 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(+a), c.updateRotationView(), m.blur()); + 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur()); }, m.onblur = function(a) { c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); }, q.onkeypress = function(a) { - 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(+a), c.updateRotationView(), q.blur()); + 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur()); }, q.onblur = function(a) { c.entity.setDirection(c.entity.getDirection()); Entry.stage.updateObject(); }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"), h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n), d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(+g.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); }, g.onblur = function(a) { c.entity.setX(c.entity.getX()); Entry.stage.updateObject(); }, k.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(+k.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); }, k.onblur = function(a) { c.entity.setY(c.entity.getY()); Entry.stage.updateObject(); @@ -10284,7 +10284,7 @@ Entry.Parser = function(b, a, c) { this.codeMirror = c; this._lang = a || "js"; this.availableCode = []; - "maze" === b && (this._stageId = +Ntry.configManager.getConfig("stageId"), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); + "maze" === b && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); this.mappingSyntax(b); switch(this._lang) { case "js": @@ -10980,7 +10980,7 @@ p = Entry.Script.prototype; p.init = function(b, a, c) { Entry.assert("BLOCK" == b.tagName.toUpperCase(), b.tagName); this.type = b.getAttribute("type"); - this.id = +b.getAttribute("id"); + this.id = Number(b.getAttribute("id")); b.getElementsByTagName("mutation").length && b.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = b.childNodes[0].getAttribute("hashid")); "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); a instanceof Entry.Script && (this.previousScript = a, a.parentScript && (this.parentScript = a.parentScript)); @@ -11044,7 +11044,7 @@ p.getValue = function(b) { return this.values[b].run(); }; p.getNumberValue = function(b) { - return +this.values[b].run(); + return Number(this.values[b].run()); }; p.getStringValue = function(b) { return String(this.values[b].run()); @@ -11059,7 +11059,7 @@ p.getStringField = function(b) { return String(this.fields[b]); }; p.getNumberField = function(b) { - return +this.fields[b]; + return Number(this.fields[b]); }; p.callReturn = function() { return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; @@ -12007,7 +12007,7 @@ Entry.getElementsByClassName = function(b) { return a; }; Entry.parseNumber = function(b) { - return "string" != typeof b || isNaN(+b) ? "number" != typeof b || isNaN(+b) ? !1 : b : +b; + return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b); }; Entry.countStringLength = function(b) { var a, c = 0; @@ -12073,7 +12073,7 @@ Entry.computeInputWidth = function(b) { document.body.appendChild(a); b = a.offsetWidth; document.body.removeChild(a); - return +(b + 10) + "px"; + return Number(b + 10) + "px"; }; Entry.isArrowOrBackspace = function(b) { return -1 < [37, 38, 39, 40, 8].indexOf(b); @@ -12238,7 +12238,7 @@ Entry.getMaxFloatPoint = function(b) { return Math.min(a, 20); }; Entry.convertToRoundedDecimals = function(b, a) { - return isNaN(b) || !this.isFloat(b) ? b : +(Math.round(b + "e" + a) + "e-" + a); + return isNaN(b) || !this.isFloat(b) ? b : Number(Math.round(b + "e" + a) + "e-" + a); }; Entry.attachEventListener = function(b, a, c) { setTimeout(function() { @@ -12597,7 +12597,7 @@ Entry.Func.generateBlock = function(b) { var a = {template:b.template, params:b.params}, c = /(%\d)/mi, d = b.template.split(c), e = "", f = 0, g = 0, h; for (h in d) { var k = d[h]; - c.test(k) ? (k = +k.split("%")[1] - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; + c.test(k) ? (k = Number(k.split("%")[1]) - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; } return {block:a, description:e}; }; @@ -12990,7 +12990,7 @@ p.removePortReadable = function(b) { var a, c; for (c in this.sendQueue.readablePorts) { if (this.sendQueue.readablePorts[c] == b) { - a = +c; + a = Number(c); break; } } @@ -13056,7 +13056,7 @@ Entry.Variable = function(b) { this.isCloud_ = b.isCloud || !1; var a = Entry.parseNumber(b.value); this.value_ = "number" == typeof a ? a : b.value ? b.value : 0; - "slide" == this.type && (this.minValue_ = +(b.minValue ? b.minValue : 0), this.maxValue_ = +(b.maxValue ? b.maxValue : 100)); + "slide" == this.type && (this.minValue_ = Number(b.minValue ? b.minValue : 0), this.maxValue_ = Number(b.maxValue ? b.maxValue : 100)); b.isClone || (this.visible_ = b.visible || "boolean" == typeof b.visible ? b.visible : !0, this.x_ = b.x ? b.x : null, this.y_ = b.y ? b.y : null, "list" == this.type && (this.width_ = b.width ? b.width : 100, this.height_ = b.height ? b.height : 120, this.array_ = b.array ? b.array : [], this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); }; Entry.Variable.prototype.generateView = function(b) { @@ -13225,13 +13225,13 @@ Entry.Variable.prototype.getId = function() { return this.id_; }; Entry.Variable.prototype.getValue = function() { - return this.isNumber() ? +this.value_ : this.value_; + return this.isNumber() ? Number(this.value_) : this.value_; }; Entry.Variable.prototype.isNumber = function() { return isNaN(this.value_) ? !1 : !0; }; Entry.Variable.prototype.setValue = function(b) { - "slide" != this.type ? this.value_ = b : (b = +b, this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); + "slide" != this.type ? this.value_ = b : (b = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); this.isCloud_ && Entry.variableContainer.updateCloudVariables(); this.updateView(); }; @@ -13333,7 +13333,7 @@ Entry.Variable.prototype.updateSlideValueByView = function() { var b = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; 0 > b && (b = 0); 1 < b && (b = 1); - var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Math.abs(c - a) * b).toFixed(2), b = parseFloat(b); + var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Number(Math.abs(c - a) * b)).toFixed(2), b = parseFloat(b); b < a ? b = this.minValue_ : b > c && (b = this.maxValue_); this.isFloatPoint() || (b = Math.round(b)); this.setValue(b); @@ -14521,7 +14521,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) { c.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.setListLength = function(b) { - b = +b; + b = Number(b); var a = this.selectedList.array_; if (!isNaN(b)) { var c = a.length; @@ -15306,7 +15306,7 @@ Entry.BlockMenu = function(b, a, c, d) { if (isNaN(a)) { return a; } - a = +a; + a = Number(a); for (var b = this._categories, d = this._categoryElems, e = 0;e < b.length;e++) { var f = b[e]; if (!d[f].hasClass("entryRemove") && 0 === a--) { @@ -15668,7 +15668,7 @@ Entry.BlockView.DRAG_RADIUS = 5; var h = e[g].trim(); if (0 !== h.length) { if (d.test(h)) { - var k = +h.split("%")[1] - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); + var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); this._contents.push(h); this._paramMap[k] = h; } else { @@ -16418,10 +16418,10 @@ Entry.Scope = function(b, a) { return String(this.getValue(a, b)); }; b.getNumberValue = function(a, b) { - return +this.getValue(a); + return Number(this.getValue(a)); }; b.getBooleanValue = function(a, b) { - return +this.getValue(a, b) ? !0 : !1; + return Number(this.getValue(a, b)) ? !0 : !1; }; b.getField = function(a, b) { return this.block.params[this._getParamIndex(a)]; @@ -16430,7 +16430,7 @@ Entry.Scope = function(b, a) { return String(this.getField(a)); }; b.getNumberField = function(a) { - return +this.getField(a); + return Number(this.getField(a)); }; b.getStatement = function(a, b) { return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); @@ -16927,16 +16927,14 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); b._position = function() { var a = this.getAbsolutePosFromDocument(); a.y += this.box.height / 2; - var b = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width(); - if (b < a.y + d) { - a.x += this.box.width + 1; - var b = this.getAbsolutePosFromBoard(), f = this._blockView.getBoard().svgDom.height(), f = f - (f - b.y); - f - 20 < d && this.optionGroup.height(f - f % 20); - a.y -= this.optionGroup.height(); + var b = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width() + 20; + if (b < a.y + d + 30) { + var b = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); + this._blockView.y < b / 2 ? (a.x += this.box.width / 2 - e / 2, b -= f.y + 30, this.optionGroup.height(b)) : (a.x += this.box.width + 1, b -= b - f.y, b - 30 < d && this.optionGroup.height(b - b % 30), a.y -= this.optionGroup.height()); } else { a.x += this.box.width / 2 - e / 2; } - this.optionGroup.css({left:a.x, top:a.y, width:e + 20}); + this.optionGroup.css({left:a.x, top:a.y, width:e}); }; b.applyValue = function(a) { this.value != a && this.setValue(a); @@ -19095,7 +19093,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; return this.mode; }; b.setMode = function(a, b) { - a = +a; + a = Number(a); var d = this.mode; this.mode = a; switch(a) { @@ -20134,7 +20132,7 @@ Entry.Xml.getNumberValue = function(b, a, c) { } for (var d in c) { if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == a) { - return +Entry.Xml.operate(b, c[d].children[0]); + return Number(Entry.Xml.operate(b, c[d].children[0])); } } return null; @@ -20157,7 +20155,7 @@ Entry.Xml.getNumberField = function(b, a) { } for (var d in c) { if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return +c[d].textContent; + return Number(c[d].textContent); } } }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 6ac2d63c65..ae6e5dcfbd 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -32,7 +32,7 @@ Blockly.Blocks.albert_stop={init:function(){this.setColour("#00979D");this.appen Blockly.Blocks.albert_set_pad_size_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_1);this.appendValueInput("WIDTH").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_2);this.appendValueInput("HEIGHT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_pad_size_to=function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; Blockly.Blocks.albert_clear_eye={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_eye_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_eye=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}; Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.turn_on,"ON"],[Lang.General.turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_body_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -62,7 +62,7 @@ Entry.block.albert_move_backward=function(b,a){var c=Entry.hw.sendQueue;if(a.isS Blockly.Blocks.albert_turn_around={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_around_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_around_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_turn_around=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a);a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}; Blockly.Blocks.albert_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.General.skyblue,"3"],[Lang.General.blue,"1"],[Lang.General.purple, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; Blockly.Blocks.albert_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}; Blockly.Blocks.albert_change_wheels_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_change_wheels_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ @@ -76,7 +76,7 @@ Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entr Blockly.Blocks.arduino_send={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_2);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.arduino_send=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}; Blockly.Blocks.arduino_get_string={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_2);this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}; +Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}; Blockly.Blocks.arduino_get_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.arduino_get_string=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}; Blockly.Blocks.arduino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_arduino_get_sensor_number_0,"A0"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_1,"A1"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_2,"A2"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_3,"A3"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_4,"A4"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_5,"A5"]]),"PORT");this.appendDummyInput().appendField(" "); @@ -181,10 +181,10 @@ Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockC Entry.block.get_rotation_direction=function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.distance_something={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_distance_something_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_distance_something_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.distance_something=function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}; -Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; Blockly.Blocks.calc_basic={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["String","Number"]);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_basic=function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_plus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; @@ -304,10 +304,10 @@ Blockly.Blocks.hamster_follow_line_until={init:function(){this.setColour("#00979 Entry.block.hamster_follow_line_until=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, g);return a}; Blockly.Blocks.hamster_set_following_speed_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_following_speed_to_1).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]]),"SPEED").appendField(Lang.Blocks.HAMSTER_set_following_speed_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED",a);return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED",a));return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_stop=function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}; Blockly.Blocks.hamster_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"], -[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; Blockly.Blocks.hamster_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()};Blockly.Blocks.hamster_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_beep=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}; @@ -328,12 +328,12 @@ Entry.block.hamster_change_tempo_by=function(b,a){Entry.Hamster.tempo+=a.getNumb Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_port_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_port_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_port_to_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"], -[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=Number(a.getField("MODE",a));"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; Blockly.Blocks.hamster_change_output_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_change_output_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}; Blockly.Blocks.hamster_set_output_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_output_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; -Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(c)}; Blockly.Blocks.reach_something={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("collision"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.reach_something=function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE",a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"== c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; +Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_hide).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hide=function(b,a){b.setVisible(!1);return a.callReturn()}; Blockly.Blocks.dialog_time={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_2);this.appendValueInput("SECOND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_3);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION"); this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -400,7 +400,7 @@ Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_by_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}; Blockly.Blocks.rotate_by_angle_dropdown={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["45","45"],["90","90"],["135","135"],["180","180"]]),"VALUE").appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}; Blockly.Blocks.see_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.see_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.see_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -412,7 +412,7 @@ Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b Blockly.Blocks.locate_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.locate_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; +Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; Blockly.Blocks.move_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.move_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; @@ -438,8 +438,8 @@ Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this. Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.locate_object_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&& +!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}; Blockly.Blocks.rotate_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -825,25 +825,26 @@ d.object=this;this.editView_=d;this.view_.appendChild(d);Entry.objectEditable?($ d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)}));d=Entry.createElement("div");d.addClass("entryObjectInformationWorkspace");d.object=this;this.isInformationToggle=!1;b.appendChild(d);this.informationView_=d;b=Entry.createElement("div");b.addClass("entryObjectRotationWrapperWorkspace");b.object=this;this.view_.appendChild(b);d=Entry.createElement("span");d.addClass("entryObjectCoordinateWorkspace"); b.appendChild(d);e=Entry.createElement("span");e.addClass("entryObjectCoordinateSpanWorkspace");e.innerHTML="X:";var g=Entry.createElement("input");g.addClass("entryObjectCoordinateInputWorkspace");g.setAttribute("readonly",!0);g.bindOnClick(function(a){a.stopPropagation();this.select()});var h=Entry.createElement("span");h.addClass("entryObjectCoordinateSpanWorkspace");h.innerHTML="Y:";var k=Entry.createElement("input");k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); k.bindOnClick(function(a){a.stopPropagation();this.select()});k.setAttribute("readonly",!0);var l=Entry.createElement("span");l.addClass("entryObjectCoordinateSizeWorkspace");l.innerHTML=Lang.Workspace.Size+" : ";var n=Entry.createElement("input");n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size");n.bindOnClick(function(a){a.stopPropagation();this.select()});n.setAttribute("readonly",!0);d.appendChild(e);d.appendChild(g);d.appendChild(h);d.appendChild(k); -d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(+g.value);c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(+k.value);c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)}; -n.onblur=function(a){isNaN(n.value)||c.entity.setSize(+n.value);c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly",!0);m.bindOnClick(function(a){a.stopPropagation(); -this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_=m;d.directionInput_=q;c=this;m.onkeypress=function(a){13== -a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(+a);c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(+a);c.updateRotationView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper"); -b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))}); -b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b); -b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id),b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&& -Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])),this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"), -d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"),b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this, -this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)})),d=Entry.createElement("button"), -d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"),this.view_.appendChild(d),this.rotateLabelWrapperView_= -d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_=q,d.appendChild(e),d.appendChild(m),d.appendChild(h), -d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(+a),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setDirection(+a),c.updateRotationView(), -q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"),g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"), -h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"),d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l), -d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(+g.value),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(+k.value),c.updateCoordinateView(),c.blur())},k.onblur=function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"), -d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"), -b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}), -this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b};Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; +d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(Number(g.value));c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(Number(k.value));c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13== +a.keyCode&&c.editObjectValues(!1)};n.onblur=function(a){isNaN(n.value)||c.entity.setSize(Number(n.value));c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly", +!0);m.bindOnClick(function(a){a.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_= +m;d.directionInput_=q;c=this;m.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(Number(a));c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(Number(a));c.updateRotationView(); +Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper");b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")|| +this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace"); +b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id), +b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&&Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])), +this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"),d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"), +b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this,this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")|| +Entry.container.removeObject(this.object)})),d=Entry.createElement("button"),d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"), +this.view_.appendChild(d),this.rotateLabelWrapperView_=d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_= +q,d.appendChild(e),d.appendChild(m),d.appendChild(h),d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(Number(a)),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))), +isNaN(a)||c.entity.setDirection(Number(a)),c.updateRotationView(),q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"), +g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"),h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"), +d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l),d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(Number(g.value)),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(Number(k.value)),c.updateCoordinateView(),c.blur())},k.onblur= +function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"),d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b), +b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_= +b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}),this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b}; +Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; Entry.EntryObject.prototype.initEntity=function(b){var a={};a.x=a.y=0;a.rotation=0;a.direction=90;if("sprite"==this.objectType){var c=b.sprite.pictures[0].dimension;a.regX=c.width/2;a.regY=c.height/2;a.scaleX=a.scaleY="background"==b.sprite.category.main?Math.max(270/c.height,480/c.width):"new"==b.sprite.category.main?1:200/(c.width+c.height);a.width=c.width;a.height=c.height}else if("textBox"==this.objectType)if(a.regX=25,a.regY=12,a.scaleX=a.scaleY=1.5,a.width=50,a.height=24,a.text=b.text,b.options){if(b= b.options,c="",b.bold&&(c+="bold "),b.italic&&(c+="italic "),a.underline=b.underline,a.strike=b.strike,a.font=c+"20px "+b.font.family,a.colour=b.colour,a.bgColor=b.background,a.lineBreak=b.lineBreak)a.width=256,a.height=.5625*a.width,a.regX=a.width/2,a.regY=a.height/2}else a.underline=!1,a.strike=!1,a.font="20px Nanum Gothic",a.colour="#000000",a.bgColor="#ffffff";return a}; Entry.EntryObject.prototype.updateThumbnailView=function(){if("sprite"==this.objectType)if(this.entity.picture.fileurl)this.thumbnailView_.style.backgroundImage='url("'+this.entity.picture.fileurl+'")';else{var b=this.entity.picture.filename;this.thumbnailView_.style.backgroundImage='url("'+Entry.defaultPath+"/uploads/"+b.substring(0,2)+"/"+b.substring(2,4)+"/thumb/"+b+'.png")'}else"textBox"==this.objectType&&(this.thumbnailView_.style.backgroundImage="url("+(Entry.mediaFilePath+"/text_icon.png")+ @@ -1004,7 +1005,7 @@ node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294 node:a};};b.initScope=function(a){if(null===this.scope){var b=function(){};b.prototype=this.syntax.Scope}else b=function(){},b.prototype=this.scope;this.scope=new b;this.scopeChain.push(this.scope);return this.scanDefinition(a)};b.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};b.scanDefinition=function(a){a=a.body;for(var b=[],d=0;d=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; (function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var d=acorn.parse(a),b=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,c){var d="";1===c&&(a+="\n");d=-1=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"), $(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; -p.init=function(b,a,c){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=+b.getAttribute("id");b.getElementsByTagName("mutation").length&&b.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=b.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);a instanceof Entry.Script&&(this.previousScript=a,a.parentScript&&(this.parentScript=a.parentScript));c instanceof Entry.Script&&(this.parentScript= -c);b=b.childNodes;for(a=0;a=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,c){return"#"+(16777216+(b<<16)+(a<<8)+c).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,c){return b>c?c:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; -Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return+(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;c/g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cd&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:+(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; +Entry.getMaxFloatPoint=function(b){for(var a=0,c=0,d=b.length;ca&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function c(){}c.prototype=b.prototype;a.prototype=new c;return a}; Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id:"entryTrashcanFilter_"+a});d.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});d.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});d=d.elem("feMerge");d.elem("feMergeNode",{"in":"offsetBlur"});d.elem("feMergeNode",{"in":"SourceGraphic"},d);d=c.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});d.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});d.elem("feColorMatrix", @@ -1168,7 +1169,7 @@ Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.me Entry.Func.requestParamBlock=function(b){var a=Entry.generateHash(),c;switch(b){case "string":c=Entry.block.function_param_string;break;case "boolean":c=Entry.block.function_param_boolean;break;default:return null}a=b+"Param_"+a;b=Entry.Func.createParamBlock(a,c,b);Entry.block[a]=b;return a}; Entry.Func.registerParamBlock=function(b){-1=Entry.HW.TRIAL_LIMIT)this.isFi JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)}.bind(this),a.onclose=function(){"WebSocket"===b.socketType&&(this.socket=null,b.initSocket())}}catch(d){}try{c=new WebSocket("wss://hardware.play-entry.org:23518")}catch(d){}}c.binaryType="arraybuffer";c.onopen=function(){b.socketType="WebSocketSecurity";b.initHardware(c)};c.onmessage=function(a){a=JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)};c.onclose=function(){"WebSocketSecurity"===b.socketType&&(this.socket=null,b.initSocket())}; Entry.dispatchEvent("hwChanged")}}catch(d){}};p.retryConnect=function(){this.connectTrial=0;this.initSocket()};p.initHardware=function(b){this.socket=b;this.connectTrial=0;this.connected=!0;Entry.dispatchEvent("hwChanged");Entry.playground&&Entry.playground.object&&Entry.playground.setMenu(Entry.playground.object.objectType)};p.setDigitalPortValue=function(b,a){this.sendQueue[b]=a;this.removePortReadable(b)};p.getAnalogPortValue=function(b){return this.connected?this.portData["a"+b]:0}; p.getDigitalPortValue=function(b){if(!this.connected)return 0;this.setPortReadable(b);return void 0!==this.portData[b]?this.portData[b]:0};p.setPortReadable=function(b){this.sendQueue.readablePorts||(this.sendQueue.readablePorts=[]);var a=!1,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=!0;break}a||this.sendQueue.readablePorts.push(b)}; -p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=+c;break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; +p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=Number(c);break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; p.updatePortData=function(b){this.portData=b;this.hwMonitor&&this.hwMonitor.update()};p.closeConnection=function(){this.socket&&this.socket.close()};p.downloadConnector=function(){window.open("http://download.play-entry.org/apps/Entry_HW_1.5.3_Setup.exe","_blank").focus()};p.downloadSource=function(){window.open("http://play-entry.com/down/board.ino","_blank").focus()};p.setZero=function(){Entry.hw.hwModule&&Entry.hw.hwModule.setZero()}; p.checkDevice=function(b){void 0!==b.company&&(b=""+b.company+b.model,b!=this.selectedDevice&&(this.selectedDevice=b,this.hwModule=this.hwInfo[b],Entry.dispatchEvent("hwChanged"),Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5","\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.",!0),this.hwModule.monitorTemplate&&(this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule, -this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=+(b.minValue?b.minValue:0),this.maxValue_=+(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"==typeof b.visible? -b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=Number(b.minValue?b.minValue:0),this.maxValue_=Number(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"== +typeof b.visible?b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(b){var a=this.type;if("variable"==a||"timer"==a||"answer"==a)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",a=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", function(a){"workspace"==Entry.type&&(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==a){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= @@ -1220,15 +1221,15 @@ this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredW this.scrollPosition+b&&ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ 14,this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+ 15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1, -2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?+this.value_:this.value_}; -Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=+b,this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_}; +Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");(this.visible_=this.view_.visible=b)&&this.updateView()};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs(this.value_-a)/Math.abs(this.maxValue_-a)*b+10}; Entry.Variable.prototype.setSlideCommandX=function(b){var a=this.valueSetter_.graphics.command;b=Math.max("undefined"==typeof b?10:b,10);b=Math.min(this.maxWidth+10,b);a.x=b;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; Entry.Variable.prototype.setMinValue=function(b){this.minValue_=b;this.value_b&&(this.value_=b);this.updateView();this.isMaxFloat=Entry.isFloat(this.maxValue_)};Entry.Variable.prototype.isFloatPoint=function(){return this.isMaxFloat||this.isMinFloat};Entry.VariableContainer=function(){this.variables_=[];this.messages_=[];this.lists_=[];this.functions_={};this.viewMode_="all";this.selected=null;this.variableAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.listAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.selectedVariable=null;this._variableRefs=[];this._messageRefs=[];this._functionRefs=[]}; Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; @@ -1326,7 +1327,7 @@ c=Entry.createElement("div");c.addClass("entryListSettingLengthControllerWorkspa d=Entry.createElement("span");d.addClass("entryListSettingPlusWorkspace");d.bindOnClick(function(a){b.selectedList.array_.push({data:0});b.updateListSettingView(b.selectedList)});c.appendChild(d);c=Entry.createElement("div");a.seperator=c;a.appendChild(c);c.addClass("entryListSettingSeperatorWorkspace");c=Entry.createElement("div");c.addClass("entryListSettingListValuesWorkspace");a.listValues=c;a.appendChild(c)}; Entry.VariableContainer.prototype.updateListSettingView=function(b){var a=this;b=b||this.selectedList;var c=this.listSettingView,d=c.listValues,e=c.visibleCheck,f=c.lengthInput,g=c.seperator;e.removeClass("entryListSettingCheckedWorkspace");b.isVisible()&&e.addClass("entryListSettingCheckedWorkspace");f.value=b.array_.length;for(b.listElement.appendChild(c);d.firstChild;)d.removeChild(d.firstChild);var h=b.array_;0===h.length?g.addClass("entryRemove"):g.removeClass("entryRemove");for(e=0;eb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +f.addClass("entryListSettingValueRemoveWorkspace");e.appendChild(f);d.appendChild(e)})(e);b.updateView();c.removeClass("entryRemove")};Entry.VariableContainer.prototype.setListLength=function(b){b=Number(b);var a=this.selectedList.array_;if(!isNaN(b)){var c=a.length;if(cb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; @@ -1395,7 +1396,7 @@ VALUE:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Ent albert_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_stop",id:"4adb"},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}},albert_set_pad_size_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["108"]},{type:"text",params:["76"]},null],type:"albert_set_pad_size_to",id:"5mhg"},paramsKeyMap:{WIDTH:0,HEIGHT:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right, "RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"albert_set_eye_to"},paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"], -func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, +func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}},albert_body_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_body_led"}, paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.bodyLed=1:c.bodyLed=0;return a.callReturn()}},albert_front_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_front_led"},paramsKeyMap:{STATE:0},"class":"albert_led", isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.frontLed=1:c.frontLed=0;return a.callReturn()}},albert_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= @@ -1412,13 +1413,13 @@ statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12 img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=-30,c.rightWheel=-30,a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_turn_around:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"], ["\uc624\ub978\ucabd","RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a); a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[["\ube68\uac04\uc0c9","4"],["\ub178\ub780\uc0c9","6"],["\ucd08\ub85d\uc0c9","2"],["\ud558\ub298\uc0c9","3"],["\ud30c\ub780\uc0c9","1"],["\ubcf4\ub77c\uc0c9", -"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", +"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("DIRECTION"),f=a.getNumberValue("VALUE");"LEFT"==e?c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f:d.leftWheel+f:("RIGHT"!=e&&(c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f: d.leftWheel+f),c.rightWheel=void 0!=c.rightWheel?c.rightWheel+f:d.rightWheel+f);return a.callReturn()}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c= Entry.hw.sendQueue,d=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e),c.rightWheel=e);return a.callReturn()}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]}, paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/", -!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", +!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"]],value:"A0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"], ["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_pwm_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]],value:"3",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{}, def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_number_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_sensor_number"}],type:"arduino_get_number_sensor_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}}, @@ -1478,17 +1479,17 @@ color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class": "ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],value:"ROTATION",fontSize:11}],events:{},def:{params:[null],type:"get_rotation_direction"},paramsKeyMap:{OPERATOR:0},"class":"calc",isNotFor:[],func:function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}},distance_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_distance_something_1, color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"},paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c); return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1}, -"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown", -options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1, -COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}},calc_basic:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number", -params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}},calc_plus:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}], -events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND", -a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/", -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", -text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, +"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"}, +{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"}, +paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}}, +calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]}, +"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}}, +calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"}, +{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND", +a),d=a.getNumberValue("RIGHTHAND",a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block", +accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[], +params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, "acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural,"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}], events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(d)&&(1c))throw Error("x range exceeded");d.indexOf("_")&&(d=d.split("_")[0]);-1<["sin","cos","tan"].indexOf(d)&&(c=Entry.toRadian(c));var e=0;switch(d){case "square":e=c*c;break;case "factorial":e=Entry.factorial(c);break; case "root":e=Math.sqrt(c);break;case "log":e=Math.log(c)/Math.LN10;break;case "ln":e=Math.log(c);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[d](c));break;case "unnatural":e=c-Math.floor(c);0>c&&(e=1-e);break;default:e=Math[d](c)}return Math.round(1E3*e)/1E3}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2, @@ -1556,11 +1557,11 @@ e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e) {type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_using"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("COLOR"),e=a.getField("DIRECTION"),f=1;"RIGHT"==e?f=2:"BOTH"==e&&(f=3);"WHITE"==d&&(f+=7);c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,f);return a.callReturn()}},hamster_follow_line_until:{color:"#00979D",skeleton:"basic", statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_black,"BLACK"],[Lang.General.white,"WHITE"]],value:"BLACK",fontSize:11},{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.Blocks.HAMSTER_front,"FRONT"],[Lang.Blocks.HAMSTER_rear,"REAR"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_until"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel", isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, -g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED", -a);return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, +g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED", +a));return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, "LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_led_to"},paramsKeyMap:{DIRECTION:0,COLOR:1}, -"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], +"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}},hamster_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"hamster_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getNumberValue("VALUE");c.buzzer=void 0!=c.buzzer?c.buzzer+d:d;c.note=0;return a.callReturn()}},hamster_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", params:["1000"]},null],type:"hamster_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.buzzer=a.getNumberValue("VALUE");c.note=0;return a.callReturn()}},hamster_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_clear_buzzer"},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c= @@ -1571,16 +1572,16 @@ hamster_rest_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:" 1;var d=a.getNumberValue("VALUE"),d=6E4*d/Entry.Hamster.tempo;c.buzzer=0;c.note=0;var e=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(e)},d);Entry.Hamster.timeouts.push(e);return a}},hamster_change_tempo_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["20"]},null],type:"hamster_change_tempo_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer", isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo+=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo= a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"], -[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}},hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE"); -"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()}},is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"}, -"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2,color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}},reach_something:{color:"#AEB8FF", -skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE", -a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"==c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y); -c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a); -return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND", +a);return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d}},boolean_smaller:{color:"#AEB8FF", skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text", params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}], -paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null], -type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown", -options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart= -!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS}, -{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}},remove_dialog:{color:"#EC4466",skeleton:"basic", -statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"}, -paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&& -(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect", -isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect", -isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* +paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a), +d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]], +value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}}, +remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, +null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png", +size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity, +"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness: +"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0, +VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"}, +"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* c);return a.callReturn()}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}},change_scale_size:{color:"#EC4466", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}},flip_x:{color:"#EC4466", @@ -1622,13 +1623,13 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",p img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY(); c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b,a){var c= -a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", +a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[], params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_x:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, {type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", +{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator", img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()- @@ -1642,10 +1643,10 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type: d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation(); b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},locate_object_time:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE", -a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+ -a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c); -return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, +a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX), +b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", +a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[], +params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0, VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3", @@ -1874,7 +1875,7 @@ b.getMode())&&Entry.GlobalSvg.addControl(a);else if(g.code&&(b=e.block,d=b.getTh this._boardBlockView;if(a){this.workspace.getBoard();this._boardBlockView=null;var b=Entry.GlobalSvg.left,d=Entry.GlobalSvg.width/2,a=a.getBoard().offset().left;return bthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1 Date: Wed, 8 Jun 2016 16:25:10 +0900 Subject: [PATCH 3/5] fix lang --- dist/entry.js | 3 +-- dist/entry.min.js | 3 +-- src/variable_container.js | 11 +++++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index e3d91f713f..7e22cdb3d0 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -14621,8 +14621,7 @@ Entry.VariableContainer.prototype._getBlockMenu = function() { }; Entry.VariableContainer.prototype._truncName = function(b, a) { b = b.substring(0, this._maxNameLength); - str = "variable" == a ? "\ubcc0\uc218" : "\ub9ac\uc2a4\ud2b8"; - Entry.toast.warning("%1 \uc774\ub984 \uc790\ub3d9 \ubcc0\uacbd".replace("%1", str), "%1\uc758 \uc774\ub984\uc740 10\uae00\uc790\ub97c \ub118\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.".replace("%1", str)); + Entry.toast.warning(Lang.Workspace[a + "_name_auto_edited_title"], Lang.Workspace[a + "_name_auto_edited_content"]); return b; }; Entry.VariableContainer.prototype._maxNameLength = 10; diff --git a/dist/entry.min.js b/dist/entry.min.js index 46b2b05474..ba79034ce5 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1334,8 +1334,7 @@ Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.pr Entry.VariableContainer.prototype.addRef=function(b,a){if(this.view_&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:a.getCode().object,block:a};a.funcBlock&&(c.funcBlock=a.funcBlock,delete a.funcBlock);this[b].push(c);if("_functionRefs"==b)for(var d=a.type.substr(5),e=Entry.variableContainer.functions_[d].content.getBlockList(),f=0;f Date: Wed, 8 Jun 2016 16:42:04 +0900 Subject: [PATCH 4/5] disable copy scene when engine is running --- dist/entry.js | 101 +++++++++++----------- dist/entry.min.js | 209 +++++++++++++++++++++++----------------------- src/scene.js | 1 + 3 files changed, 157 insertions(+), 154 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index f461ced62c..66f34904c8 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -356,7 +356,7 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_eye_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftEye = e : ("RIGHT" != d && (c.leftEye = e), c.rightEye = e); return a.callReturn(); }; @@ -667,7 +667,7 @@ Blockly.Blocks.albert_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "FRONT" == d ? (c.leftEye = e, c.rightEye = e) : "LEFT" == d ? c.leftEye = e : c.rightEye = e; return a.callReturn(); }; @@ -774,7 +774,7 @@ Entry.block.arduino_get_number = function(b, a) { d.open("POST", "http://localhost:23518/arduino/", !1); d.send(String(c)); Entry.assert(200 == d.status, "arduino is not connected"); - return +d.responseText; + return Number(d.responseText); }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -1639,7 +1639,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() { this.setInputsInline(!0); }}; Entry.block.coordinate_mouse = function(b, a) { - return "x" === a.getField("VALUE", a) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y; + return "x" === a.getField("VALUE", a) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y); }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1663,7 +1663,7 @@ Entry.block.coordinate_object = function(b, a) { var d = c.parent, d = d.pictures; return d.indexOf(c.picture) + 1; case "size": - return +c.getSize().toFixed(1); + return Number(c.getSize().toFixed(1)); case "picture_name": return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name; } @@ -2806,7 +2806,7 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_following_speed_to = function(b, a) { - Entry.hw.sendQueue.lineTracerSpeed = +a.getField("SPEED", a); + Entry.hw.sendQueue.lineTracerSpeed = Number(a.getField("SPEED", a)); return a.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { @@ -2832,7 +2832,7 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftLed = e : ("RIGHT" != d && (c.leftLed = e), c.rightLed = e); return a.callReturn(); }; @@ -3031,7 +3031,7 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_port_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = +a.getField("MODE", a); + var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = Number(a.getField("MODE", a)); "A" == d ? c.ioModeA = e : ("B" != d && (c.ioModeA = e), c.ioModeB = e); return a.callReturn(); }; @@ -3080,7 +3080,7 @@ Blockly.Blocks.is_press_some_key = {init:function() { this.setInputsInline(!0); }}; Entry.block.is_press_some_key = function(b, a) { - var c = +a.getField("VALUE", a); + var c = Number(a.getField("VALUE", a)); return 0 <= Entry.pressedKeys.indexOf(c); }; Blockly.Blocks.reach_something = {init:function() { @@ -3294,13 +3294,13 @@ Entry.block.boolean_basic_operator = function(b, a) { case "EQUAL": return d == e; case "GREATER": - return +d > +e; + return Number(d) > Number(e); case "LESS": - return +d < +e; + return Number(d) < Number(e); case "GREATER_OR_EQUAL": - return +d >= +e; + return Number(d) >= Number(e); case "LESS_OR_EQUAL": - return +d <= +e; + return Number(d) <= Number(e); } }; Blockly.Blocks.show = {init:function() { @@ -3782,7 +3782,7 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { }}; Entry.block.rotate_by_angle_dropdown = function(b, a) { var c = a.getField("VALUE", a); - b.setRotation(b.getRotation() + +c); + b.setRotation(b.getRotation() + Number(c)); return a.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { @@ -3874,8 +3874,8 @@ Blockly.Blocks.locate = {init:function() { Entry.block.locate = function(b, a) { var c = a.getField("VALUE", a), d; "mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY()); - b.setX(+c); - b.setY(+d); + b.setX(Number(c)); + b.setY(Number(d)); b.brush && !b.brush.stop && b.brush.lineTo(c, -1 * d); return a.callReturn(); }; @@ -4071,7 +4071,7 @@ Entry.block.locate_object_time = function(b, a) { if (0 != c) { "mouse" == d ? (d = e.x - b.getX(), e = e.y - b.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - b.getX(), e = e.getY() - b.getY()), a.isStart = !0, a.frameCount = c, a.dX = d / a.frameCount, a.dY = e / a.frameCount; } else { - return "mouse" == d ? (d = +e.x, e = +e.y) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); + return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); } } if (0 != a.frameCount) { @@ -8190,7 +8190,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; g.onblur = function(a) { - isNaN(g.value) || c.entity.setX(+g.value); + isNaN(g.value) || c.entity.setX(Number(g.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8198,7 +8198,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; k.onblur = function(a) { - isNaN(k.value) || c.entity.setY(+k.value); + isNaN(k.value) || c.entity.setY(Number(k.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8206,7 +8206,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; n.onblur = function(a) { - isNaN(n.value) || c.entity.setSize(+n.value); + isNaN(n.value) || c.entity.setSize(Number(n.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8250,7 +8250,7 @@ Entry.EntryObject.prototype.generateView = function() { m.onblur = function(a) { a = m.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setRotation(+a); + isNaN(a) || c.entity.setRotation(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8260,7 +8260,7 @@ Entry.EntryObject.prototype.generateView = function() { q.onblur = function(a) { a = q.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setDirection(+a); + isNaN(a) || c.entity.setDirection(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8332,24 +8332,24 @@ Entry.EntryObject.prototype.generateView = function() { } }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"), m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) { - 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(+a), c.updateRotationView(), m.blur()); + 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur()); }, m.onblur = function(a) { c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); }, q.onkeypress = function(a) { - 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(+a), c.updateRotationView(), q.blur()); + 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur()); }, q.onblur = function(a) { c.entity.setDirection(c.entity.getDirection()); Entry.stage.updateObject(); }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"), h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n), d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(+g.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); }, g.onblur = function(a) { c.entity.setX(c.entity.getX()); Entry.stage.updateObject(); }, k.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(+k.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); }, k.onblur = function(a) { c.entity.setY(c.entity.getY()); Entry.stage.updateObject(); @@ -10284,7 +10284,7 @@ Entry.Parser = function(b, a, c) { this.codeMirror = c; this._lang = a || "js"; this.availableCode = []; - "maze" === b && (this._stageId = +Ntry.configManager.getConfig("stageId"), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); + "maze" === b && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); this.mappingSyntax(b); switch(this._lang) { case "js": @@ -10838,9 +10838,10 @@ Entry.Scene.prototype.generateElement = function(b) { } Entry.Utils.disableContextmenu(c); $(c).on("contextmenu", function() { - Entry.ContextMenu.show([{text:Lang.Workspace.duplicate_scene, callback:function() { + var a = [{text:Lang.Workspace.duplicate_scene, enable:!Entry.engine.isState("run"), callback:function() { Entry.scene.cloneScene(b); - }}], "workspace-contextmenu"); + }}]; + Entry.ContextMenu.show(a, "workspace-contextmenu"); }); return b.view = c; }; @@ -10980,7 +10981,7 @@ p = Entry.Script.prototype; p.init = function(b, a, c) { Entry.assert("BLOCK" == b.tagName.toUpperCase(), b.tagName); this.type = b.getAttribute("type"); - this.id = +b.getAttribute("id"); + this.id = Number(b.getAttribute("id")); b.getElementsByTagName("mutation").length && b.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = b.childNodes[0].getAttribute("hashid")); "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); a instanceof Entry.Script && (this.previousScript = a, a.parentScript && (this.parentScript = a.parentScript)); @@ -11044,7 +11045,7 @@ p.getValue = function(b) { return this.values[b].run(); }; p.getNumberValue = function(b) { - return +this.values[b].run(); + return Number(this.values[b].run()); }; p.getStringValue = function(b) { return String(this.values[b].run()); @@ -11059,7 +11060,7 @@ p.getStringField = function(b) { return String(this.fields[b]); }; p.getNumberField = function(b) { - return +this.fields[b]; + return Number(this.fields[b]); }; p.callReturn = function() { return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; @@ -12007,7 +12008,7 @@ Entry.getElementsByClassName = function(b) { return a; }; Entry.parseNumber = function(b) { - return "string" != typeof b || isNaN(+b) ? "number" != typeof b || isNaN(+b) ? !1 : b : +b; + return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b); }; Entry.countStringLength = function(b) { var a, c = 0; @@ -12073,7 +12074,7 @@ Entry.computeInputWidth = function(b) { document.body.appendChild(a); b = a.offsetWidth; document.body.removeChild(a); - return +(b + 10) + "px"; + return Number(b + 10) + "px"; }; Entry.isArrowOrBackspace = function(b) { return -1 < [37, 38, 39, 40, 8].indexOf(b); @@ -12238,7 +12239,7 @@ Entry.getMaxFloatPoint = function(b) { return Math.min(a, 20); }; Entry.convertToRoundedDecimals = function(b, a) { - return isNaN(b) || !this.isFloat(b) ? b : +(Math.round(b + "e" + a) + "e-" + a); + return isNaN(b) || !this.isFloat(b) ? b : Number(Math.round(b + "e" + a) + "e-" + a); }; Entry.attachEventListener = function(b, a, c) { setTimeout(function() { @@ -12597,7 +12598,7 @@ Entry.Func.generateBlock = function(b) { var a = {template:b.template, params:b.params}, c = /(%\d)/mi, d = b.template.split(c), e = "", f = 0, g = 0, h; for (h in d) { var k = d[h]; - c.test(k) ? (k = +k.split("%")[1] - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; + c.test(k) ? (k = Number(k.split("%")[1]) - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; } return {block:a, description:e}; }; @@ -12990,7 +12991,7 @@ p.removePortReadable = function(b) { var a, c; for (c in this.sendQueue.readablePorts) { if (this.sendQueue.readablePorts[c] == b) { - a = +c; + a = Number(c); break; } } @@ -13056,7 +13057,7 @@ Entry.Variable = function(b) { this.isCloud_ = b.isCloud || !1; var a = Entry.parseNumber(b.value); this.value_ = "number" == typeof a ? a : b.value ? b.value : 0; - "slide" == this.type && (this.minValue_ = +(b.minValue ? b.minValue : 0), this.maxValue_ = +(b.maxValue ? b.maxValue : 100)); + "slide" == this.type && (this.minValue_ = Number(b.minValue ? b.minValue : 0), this.maxValue_ = Number(b.maxValue ? b.maxValue : 100)); b.isClone || (this.visible_ = b.visible || "boolean" == typeof b.visible ? b.visible : !0, this.x_ = b.x ? b.x : null, this.y_ = b.y ? b.y : null, "list" == this.type && (this.width_ = b.width ? b.width : 100, this.height_ = b.height ? b.height : 120, this.array_ = b.array ? b.array : [], this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); }; Entry.Variable.prototype.generateView = function(b) { @@ -13225,13 +13226,13 @@ Entry.Variable.prototype.getId = function() { return this.id_; }; Entry.Variable.prototype.getValue = function() { - return this.isNumber() ? +this.value_ : this.value_; + return this.isNumber() ? Number(this.value_) : this.value_; }; Entry.Variable.prototype.isNumber = function() { return isNaN(this.value_) ? !1 : !0; }; Entry.Variable.prototype.setValue = function(b) { - "slide" != this.type ? this.value_ = b : (b = +b, this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); + "slide" != this.type ? this.value_ = b : (b = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); this.isCloud_ && Entry.variableContainer.updateCloudVariables(); this.updateView(); }; @@ -13333,7 +13334,7 @@ Entry.Variable.prototype.updateSlideValueByView = function() { var b = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; 0 > b && (b = 0); 1 < b && (b = 1); - var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Math.abs(c - a) * b).toFixed(2), b = parseFloat(b); + var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Number(Math.abs(c - a) * b)).toFixed(2), b = parseFloat(b); b < a ? b = this.minValue_ : b > c && (b = this.maxValue_); this.isFloatPoint() || (b = Math.round(b)); this.setValue(b); @@ -14521,7 +14522,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) { c.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.setListLength = function(b) { - b = +b; + b = Number(b); var a = this.selectedList.array_; if (!isNaN(b)) { var c = a.length; @@ -15306,7 +15307,7 @@ Entry.BlockMenu = function(b, a, c, d) { if (isNaN(a)) { return a; } - a = +a; + a = Number(a); for (var b = this._categories, d = this._categoryElems, e = 0;e < b.length;e++) { var f = b[e]; if (!d[f].hasClass("entryRemove") && 0 === a--) { @@ -15668,7 +15669,7 @@ Entry.BlockView.DRAG_RADIUS = 5; var h = e[g].trim(); if (0 !== h.length) { if (d.test(h)) { - var k = +h.split("%")[1] - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); + var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); this._contents.push(h); this._paramMap[k] = h; } else { @@ -16418,10 +16419,10 @@ Entry.Scope = function(b, a) { return String(this.getValue(a, b)); }; b.getNumberValue = function(a, b) { - return +this.getValue(a); + return Number(this.getValue(a)); }; b.getBooleanValue = function(a, b) { - return +this.getValue(a, b) ? !0 : !1; + return Number(this.getValue(a, b)) ? !0 : !1; }; b.getField = function(a, b) { return this.block.params[this._getParamIndex(a)]; @@ -16430,7 +16431,7 @@ Entry.Scope = function(b, a) { return String(this.getField(a)); }; b.getNumberField = function(a) { - return +this.getField(a); + return Number(this.getField(a)); }; b.getStatement = function(a, b) { return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); @@ -19095,7 +19096,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; return this.mode; }; b.setMode = function(a, b) { - a = +a; + a = Number(a); var d = this.mode; this.mode = a; switch(a) { @@ -20134,7 +20135,7 @@ Entry.Xml.getNumberValue = function(b, a, c) { } for (var d in c) { if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == a) { - return +Entry.Xml.operate(b, c[d].children[0]); + return Number(Entry.Xml.operate(b, c[d].children[0])); } } return null; @@ -20157,7 +20158,7 @@ Entry.Xml.getNumberField = function(b, a) { } for (var d in c) { if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return +c[d].textContent; + return Number(c[d].textContent); } } }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 6ac2d63c65..02a152d1aa 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -32,7 +32,7 @@ Blockly.Blocks.albert_stop={init:function(){this.setColour("#00979D");this.appen Blockly.Blocks.albert_set_pad_size_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_1);this.appendValueInput("WIDTH").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_2);this.appendValueInput("HEIGHT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_pad_size_to=function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; Blockly.Blocks.albert_clear_eye={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_eye_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_eye=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}; Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.turn_on,"ON"],[Lang.General.turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_body_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -62,7 +62,7 @@ Entry.block.albert_move_backward=function(b,a){var c=Entry.hw.sendQueue;if(a.isS Blockly.Blocks.albert_turn_around={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_around_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_around_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_turn_around=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a);a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}; Blockly.Blocks.albert_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.General.skyblue,"3"],[Lang.General.blue,"1"],[Lang.General.purple, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; Blockly.Blocks.albert_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}; Blockly.Blocks.albert_change_wheels_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_change_wheels_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ @@ -76,7 +76,7 @@ Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entr Blockly.Blocks.arduino_send={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_2);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.arduino_send=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}; Blockly.Blocks.arduino_get_string={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_2);this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}; +Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}; Blockly.Blocks.arduino_get_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.arduino_get_string=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}; Blockly.Blocks.arduino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_arduino_get_sensor_number_0,"A0"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_1,"A1"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_2,"A2"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_3,"A3"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_4,"A4"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_5,"A5"]]),"PORT");this.appendDummyInput().appendField(" "); @@ -181,10 +181,10 @@ Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockC Entry.block.get_rotation_direction=function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.distance_something={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_distance_something_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_distance_something_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.distance_something=function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}; -Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; Blockly.Blocks.calc_basic={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["String","Number"]);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_basic=function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_plus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; @@ -304,10 +304,10 @@ Blockly.Blocks.hamster_follow_line_until={init:function(){this.setColour("#00979 Entry.block.hamster_follow_line_until=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, g);return a}; Blockly.Blocks.hamster_set_following_speed_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_following_speed_to_1).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]]),"SPEED").appendField(Lang.Blocks.HAMSTER_set_following_speed_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED",a);return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED",a));return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_stop=function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}; Blockly.Blocks.hamster_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"], -[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; Blockly.Blocks.hamster_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()};Blockly.Blocks.hamster_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_beep=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}; @@ -328,12 +328,12 @@ Entry.block.hamster_change_tempo_by=function(b,a){Entry.Hamster.tempo+=a.getNumb Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_port_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_port_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_port_to_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"], -[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=Number(a.getField("MODE",a));"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; Blockly.Blocks.hamster_change_output_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_change_output_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}; Blockly.Blocks.hamster_set_output_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_output_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; -Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(c)}; Blockly.Blocks.reach_something={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("collision"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.reach_something=function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE",a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"== c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; +Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_hide).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hide=function(b,a){b.setVisible(!1);return a.callReturn()}; Blockly.Blocks.dialog_time={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_2);this.appendValueInput("SECOND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_3);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION"); this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -400,7 +400,7 @@ Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_by_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}; Blockly.Blocks.rotate_by_angle_dropdown={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["45","45"],["90","90"],["135","135"],["180","180"]]),"VALUE").appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}; Blockly.Blocks.see_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.see_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.see_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -412,7 +412,7 @@ Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b Blockly.Blocks.locate_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.locate_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; +Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; Blockly.Blocks.move_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.move_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; @@ -438,8 +438,8 @@ Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this. Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.locate_object_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&& +!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}; Blockly.Blocks.rotate_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -825,25 +825,26 @@ d.object=this;this.editView_=d;this.view_.appendChild(d);Entry.objectEditable?($ d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)}));d=Entry.createElement("div");d.addClass("entryObjectInformationWorkspace");d.object=this;this.isInformationToggle=!1;b.appendChild(d);this.informationView_=d;b=Entry.createElement("div");b.addClass("entryObjectRotationWrapperWorkspace");b.object=this;this.view_.appendChild(b);d=Entry.createElement("span");d.addClass("entryObjectCoordinateWorkspace"); b.appendChild(d);e=Entry.createElement("span");e.addClass("entryObjectCoordinateSpanWorkspace");e.innerHTML="X:";var g=Entry.createElement("input");g.addClass("entryObjectCoordinateInputWorkspace");g.setAttribute("readonly",!0);g.bindOnClick(function(a){a.stopPropagation();this.select()});var h=Entry.createElement("span");h.addClass("entryObjectCoordinateSpanWorkspace");h.innerHTML="Y:";var k=Entry.createElement("input");k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); k.bindOnClick(function(a){a.stopPropagation();this.select()});k.setAttribute("readonly",!0);var l=Entry.createElement("span");l.addClass("entryObjectCoordinateSizeWorkspace");l.innerHTML=Lang.Workspace.Size+" : ";var n=Entry.createElement("input");n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size");n.bindOnClick(function(a){a.stopPropagation();this.select()});n.setAttribute("readonly",!0);d.appendChild(e);d.appendChild(g);d.appendChild(h);d.appendChild(k); -d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(+g.value);c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(+k.value);c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)}; -n.onblur=function(a){isNaN(n.value)||c.entity.setSize(+n.value);c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly",!0);m.bindOnClick(function(a){a.stopPropagation(); -this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_=m;d.directionInput_=q;c=this;m.onkeypress=function(a){13== -a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(+a);c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(+a);c.updateRotationView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper"); -b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))}); -b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b); -b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id),b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&& -Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])),this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"), -d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"),b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this, -this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)})),d=Entry.createElement("button"), -d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"),this.view_.appendChild(d),this.rotateLabelWrapperView_= -d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_=q,d.appendChild(e),d.appendChild(m),d.appendChild(h), -d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(+a),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setDirection(+a),c.updateRotationView(), -q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"),g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"), -h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"),d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l), -d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(+g.value),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(+k.value),c.updateCoordinateView(),c.blur())},k.onblur=function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"), -d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"), -b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}), -this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b};Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; +d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(Number(g.value));c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(Number(k.value));c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13== +a.keyCode&&c.editObjectValues(!1)};n.onblur=function(a){isNaN(n.value)||c.entity.setSize(Number(n.value));c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly", +!0);m.bindOnClick(function(a){a.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_= +m;d.directionInput_=q;c=this;m.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(Number(a));c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(Number(a));c.updateRotationView(); +Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper");b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")|| +this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace"); +b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id), +b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&&Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])), +this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"),d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"), +b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this,this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")|| +Entry.container.removeObject(this.object)})),d=Entry.createElement("button"),d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"), +this.view_.appendChild(d),this.rotateLabelWrapperView_=d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_= +q,d.appendChild(e),d.appendChild(m),d.appendChild(h),d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(Number(a)),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))), +isNaN(a)||c.entity.setDirection(Number(a)),c.updateRotationView(),q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"), +g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"),h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"), +d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l),d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(Number(g.value)),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(Number(k.value)),c.updateCoordinateView(),c.blur())},k.onblur= +function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"),d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b), +b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_= +b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}),this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b}; +Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; Entry.EntryObject.prototype.initEntity=function(b){var a={};a.x=a.y=0;a.rotation=0;a.direction=90;if("sprite"==this.objectType){var c=b.sprite.pictures[0].dimension;a.regX=c.width/2;a.regY=c.height/2;a.scaleX=a.scaleY="background"==b.sprite.category.main?Math.max(270/c.height,480/c.width):"new"==b.sprite.category.main?1:200/(c.width+c.height);a.width=c.width;a.height=c.height}else if("textBox"==this.objectType)if(a.regX=25,a.regY=12,a.scaleX=a.scaleY=1.5,a.width=50,a.height=24,a.text=b.text,b.options){if(b= b.options,c="",b.bold&&(c+="bold "),b.italic&&(c+="italic "),a.underline=b.underline,a.strike=b.strike,a.font=c+"20px "+b.font.family,a.colour=b.colour,a.bgColor=b.background,a.lineBreak=b.lineBreak)a.width=256,a.height=.5625*a.width,a.regX=a.width/2,a.regY=a.height/2}else a.underline=!1,a.strike=!1,a.font="20px Nanum Gothic",a.colour="#000000",a.bgColor="#ffffff";return a}; Entry.EntryObject.prototype.updateThumbnailView=function(){if("sprite"==this.objectType)if(this.entity.picture.fileurl)this.thumbnailView_.style.backgroundImage='url("'+this.entity.picture.fileurl+'")';else{var b=this.entity.picture.filename;this.thumbnailView_.style.backgroundImage='url("'+Entry.defaultPath+"/uploads/"+b.substring(0,2)+"/"+b.substring(2,4)+"/thumb/"+b+'.png")'}else"textBox"==this.objectType&&(this.thumbnailView_.style.backgroundImage="url("+(Entry.mediaFilePath+"/text_icon.png")+ @@ -1004,7 +1005,7 @@ node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294 node:a};};b.initScope=function(a){if(null===this.scope){var b=function(){};b.prototype=this.syntax.Scope}else b=function(){},b.prototype=this.scope;this.scope=new b;this.scopeChain.push(this.scope);return this.scanDefinition(a)};b.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};b.scanDefinition=function(a){a=a.body;for(var b=[],d=0;d=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; (function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var d=acorn.parse(a),b=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,c){var d="";1===c&&(a+="\n");d=-1=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"), $(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; -p.init=function(b,a,c){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=+b.getAttribute("id");b.getElementsByTagName("mutation").length&&b.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=b.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);a instanceof Entry.Script&&(this.previousScript=a,a.parentScript&&(this.parentScript=a.parentScript));c instanceof Entry.Script&&(this.parentScript= -c);b=b.childNodes;for(a=0;a=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,c){return"#"+(16777216+(b<<16)+(a<<8)+c).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,c){return b>c?c:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; -Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return+(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;c/g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cd&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:+(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; +Entry.getMaxFloatPoint=function(b){for(var a=0,c=0,d=b.length;ca&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function c(){}c.prototype=b.prototype;a.prototype=new c;return a}; Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id:"entryTrashcanFilter_"+a});d.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});d.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});d=d.elem("feMerge");d.elem("feMergeNode",{"in":"offsetBlur"});d.elem("feMergeNode",{"in":"SourceGraphic"},d);d=c.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});d.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});d.elem("feColorMatrix", @@ -1168,7 +1169,7 @@ Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.me Entry.Func.requestParamBlock=function(b){var a=Entry.generateHash(),c;switch(b){case "string":c=Entry.block.function_param_string;break;case "boolean":c=Entry.block.function_param_boolean;break;default:return null}a=b+"Param_"+a;b=Entry.Func.createParamBlock(a,c,b);Entry.block[a]=b;return a}; Entry.Func.registerParamBlock=function(b){-1=Entry.HW.TRIAL_LIMIT)this.isFi JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)}.bind(this),a.onclose=function(){"WebSocket"===b.socketType&&(this.socket=null,b.initSocket())}}catch(d){}try{c=new WebSocket("wss://hardware.play-entry.org:23518")}catch(d){}}c.binaryType="arraybuffer";c.onopen=function(){b.socketType="WebSocketSecurity";b.initHardware(c)};c.onmessage=function(a){a=JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)};c.onclose=function(){"WebSocketSecurity"===b.socketType&&(this.socket=null,b.initSocket())}; Entry.dispatchEvent("hwChanged")}}catch(d){}};p.retryConnect=function(){this.connectTrial=0;this.initSocket()};p.initHardware=function(b){this.socket=b;this.connectTrial=0;this.connected=!0;Entry.dispatchEvent("hwChanged");Entry.playground&&Entry.playground.object&&Entry.playground.setMenu(Entry.playground.object.objectType)};p.setDigitalPortValue=function(b,a){this.sendQueue[b]=a;this.removePortReadable(b)};p.getAnalogPortValue=function(b){return this.connected?this.portData["a"+b]:0}; p.getDigitalPortValue=function(b){if(!this.connected)return 0;this.setPortReadable(b);return void 0!==this.portData[b]?this.portData[b]:0};p.setPortReadable=function(b){this.sendQueue.readablePorts||(this.sendQueue.readablePorts=[]);var a=!1,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=!0;break}a||this.sendQueue.readablePorts.push(b)}; -p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=+c;break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; +p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=Number(c);break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; p.updatePortData=function(b){this.portData=b;this.hwMonitor&&this.hwMonitor.update()};p.closeConnection=function(){this.socket&&this.socket.close()};p.downloadConnector=function(){window.open("http://download.play-entry.org/apps/Entry_HW_1.5.3_Setup.exe","_blank").focus()};p.downloadSource=function(){window.open("http://play-entry.com/down/board.ino","_blank").focus()};p.setZero=function(){Entry.hw.hwModule&&Entry.hw.hwModule.setZero()}; p.checkDevice=function(b){void 0!==b.company&&(b=""+b.company+b.model,b!=this.selectedDevice&&(this.selectedDevice=b,this.hwModule=this.hwInfo[b],Entry.dispatchEvent("hwChanged"),Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5","\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.",!0),this.hwModule.monitorTemplate&&(this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule, -this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=+(b.minValue?b.minValue:0),this.maxValue_=+(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"==typeof b.visible? -b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=Number(b.minValue?b.minValue:0),this.maxValue_=Number(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"== +typeof b.visible?b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(b){var a=this.type;if("variable"==a||"timer"==a||"answer"==a)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",a=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", function(a){"workspace"==Entry.type&&(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==a){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= @@ -1220,15 +1221,15 @@ this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredW this.scrollPosition+b&&ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ 14,this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+ 15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1, -2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?+this.value_:this.value_}; -Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=+b,this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_}; +Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");(this.visible_=this.view_.visible=b)&&this.updateView()};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs(this.value_-a)/Math.abs(this.maxValue_-a)*b+10}; Entry.Variable.prototype.setSlideCommandX=function(b){var a=this.valueSetter_.graphics.command;b=Math.max("undefined"==typeof b?10:b,10);b=Math.min(this.maxWidth+10,b);a.x=b;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; Entry.Variable.prototype.setMinValue=function(b){this.minValue_=b;this.value_b&&(this.value_=b);this.updateView();this.isMaxFloat=Entry.isFloat(this.maxValue_)};Entry.Variable.prototype.isFloatPoint=function(){return this.isMaxFloat||this.isMinFloat};Entry.VariableContainer=function(){this.variables_=[];this.messages_=[];this.lists_=[];this.functions_={};this.viewMode_="all";this.selected=null;this.variableAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.listAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.selectedVariable=null;this._variableRefs=[];this._messageRefs=[];this._functionRefs=[]}; Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; @@ -1326,7 +1327,7 @@ c=Entry.createElement("div");c.addClass("entryListSettingLengthControllerWorkspa d=Entry.createElement("span");d.addClass("entryListSettingPlusWorkspace");d.bindOnClick(function(a){b.selectedList.array_.push({data:0});b.updateListSettingView(b.selectedList)});c.appendChild(d);c=Entry.createElement("div");a.seperator=c;a.appendChild(c);c.addClass("entryListSettingSeperatorWorkspace");c=Entry.createElement("div");c.addClass("entryListSettingListValuesWorkspace");a.listValues=c;a.appendChild(c)}; Entry.VariableContainer.prototype.updateListSettingView=function(b){var a=this;b=b||this.selectedList;var c=this.listSettingView,d=c.listValues,e=c.visibleCheck,f=c.lengthInput,g=c.seperator;e.removeClass("entryListSettingCheckedWorkspace");b.isVisible()&&e.addClass("entryListSettingCheckedWorkspace");f.value=b.array_.length;for(b.listElement.appendChild(c);d.firstChild;)d.removeChild(d.firstChild);var h=b.array_;0===h.length?g.addClass("entryRemove"):g.removeClass("entryRemove");for(e=0;eb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +f.addClass("entryListSettingValueRemoveWorkspace");e.appendChild(f);d.appendChild(e)})(e);b.updateView();c.removeClass("entryRemove")};Entry.VariableContainer.prototype.setListLength=function(b){b=Number(b);var a=this.selectedList.array_;if(!isNaN(b)){var c=a.length;if(cb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; @@ -1395,7 +1396,7 @@ VALUE:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Ent albert_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_stop",id:"4adb"},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}},albert_set_pad_size_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["108"]},{type:"text",params:["76"]},null],type:"albert_set_pad_size_to",id:"5mhg"},paramsKeyMap:{WIDTH:0,HEIGHT:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right, "RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"albert_set_eye_to"},paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"], -func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, +func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}},albert_body_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_body_led"}, paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.bodyLed=1:c.bodyLed=0;return a.callReturn()}},albert_front_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_front_led"},paramsKeyMap:{STATE:0},"class":"albert_led", isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.frontLed=1:c.frontLed=0;return a.callReturn()}},albert_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= @@ -1412,13 +1413,13 @@ statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12 img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=-30,c.rightWheel=-30,a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_turn_around:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"], ["\uc624\ub978\ucabd","RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a); a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[["\ube68\uac04\uc0c9","4"],["\ub178\ub780\uc0c9","6"],["\ucd08\ub85d\uc0c9","2"],["\ud558\ub298\uc0c9","3"],["\ud30c\ub780\uc0c9","1"],["\ubcf4\ub77c\uc0c9", -"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", +"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("DIRECTION"),f=a.getNumberValue("VALUE");"LEFT"==e?c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f:d.leftWheel+f:("RIGHT"!=e&&(c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f: d.leftWheel+f),c.rightWheel=void 0!=c.rightWheel?c.rightWheel+f:d.rightWheel+f);return a.callReturn()}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c= Entry.hw.sendQueue,d=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e),c.rightWheel=e);return a.callReturn()}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]}, paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/", -!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", +!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"]],value:"A0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"], ["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_pwm_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]],value:"3",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{}, def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_number_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_sensor_number"}],type:"arduino_get_number_sensor_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}}, @@ -1478,17 +1479,17 @@ color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class": "ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],value:"ROTATION",fontSize:11}],events:{},def:{params:[null],type:"get_rotation_direction"},paramsKeyMap:{OPERATOR:0},"class":"calc",isNotFor:[],func:function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}},distance_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_distance_something_1, color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"},paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c); return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1}, -"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown", -options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1, -COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}},calc_basic:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number", -params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}},calc_plus:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}], -events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND", -a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/", -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", -text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, +"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"}, +{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"}, +paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}}, +calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]}, +"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}}, +calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"}, +{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND", +a),d=a.getNumberValue("RIGHTHAND",a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block", +accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[], +params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, "acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural,"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}], events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(d)&&(1c))throw Error("x range exceeded");d.indexOf("_")&&(d=d.split("_")[0]);-1<["sin","cos","tan"].indexOf(d)&&(c=Entry.toRadian(c));var e=0;switch(d){case "square":e=c*c;break;case "factorial":e=Entry.factorial(c);break; case "root":e=Math.sqrt(c);break;case "log":e=Math.log(c)/Math.LN10;break;case "ln":e=Math.log(c);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[d](c));break;case "unnatural":e=c-Math.floor(c);0>c&&(e=1-e);break;default:e=Math[d](c)}return Math.round(1E3*e)/1E3}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2, @@ -1556,11 +1557,11 @@ e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e) {type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_using"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("COLOR"),e=a.getField("DIRECTION"),f=1;"RIGHT"==e?f=2:"BOTH"==e&&(f=3);"WHITE"==d&&(f+=7);c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,f);return a.callReturn()}},hamster_follow_line_until:{color:"#00979D",skeleton:"basic", statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_black,"BLACK"],[Lang.General.white,"WHITE"]],value:"BLACK",fontSize:11},{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.Blocks.HAMSTER_front,"FRONT"],[Lang.Blocks.HAMSTER_rear,"REAR"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_until"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel", isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, -g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED", -a);return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, +g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED", +a));return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, "LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_led_to"},paramsKeyMap:{DIRECTION:0,COLOR:1}, -"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], +"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}},hamster_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"hamster_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getNumberValue("VALUE");c.buzzer=void 0!=c.buzzer?c.buzzer+d:d;c.note=0;return a.callReturn()}},hamster_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", params:["1000"]},null],type:"hamster_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.buzzer=a.getNumberValue("VALUE");c.note=0;return a.callReturn()}},hamster_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_clear_buzzer"},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c= @@ -1571,16 +1572,16 @@ hamster_rest_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:" 1;var d=a.getNumberValue("VALUE"),d=6E4*d/Entry.Hamster.tempo;c.buzzer=0;c.note=0;var e=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(e)},d);Entry.Hamster.timeouts.push(e);return a}},hamster_change_tempo_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["20"]},null],type:"hamster_change_tempo_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer", isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo+=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo= a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"], -[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}},hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE"); -"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()}},is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"}, -"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2,color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}},reach_something:{color:"#AEB8FF", -skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE", -a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"==c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y); -c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a); -return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND", +a);return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d}},boolean_smaller:{color:"#AEB8FF", skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text", params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}], -paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null], -type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown", -options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart= -!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS}, -{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}},remove_dialog:{color:"#EC4466",skeleton:"basic", -statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"}, -paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&& -(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect", -isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect", -isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* +paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a), +d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]], +value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}}, +remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, +null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png", +size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity, +"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness: +"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0, +VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"}, +"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* c);return a.callReturn()}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}},change_scale_size:{color:"#EC4466", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}},flip_x:{color:"#EC4466", @@ -1622,13 +1623,13 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",p img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY(); c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b,a){var c= -a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", +a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[], params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_x:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, {type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", +{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator", img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()- @@ -1642,10 +1643,10 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type: d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation(); b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},locate_object_time:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE", -a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+ -a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c); -return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, +a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX), +b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", +a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[], +params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0, VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3", @@ -1874,7 +1875,7 @@ b.getMode())&&Entry.GlobalSvg.addControl(a);else if(g.code&&(b=e.block,d=b.getTh this._boardBlockView;if(a){this.workspace.getBoard();this._boardBlockView=null;var b=Entry.GlobalSvg.left,d=Entry.GlobalSvg.width/2,a=a.getBoard().offset().left;return bthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1 Date: Wed, 8 Jun 2016 17:56:31 +0900 Subject: [PATCH 5/5] focusing after add message --- dist/entry.js | 97 +++++++++--------- dist/entry.min.js | 207 +++++++++++++++++++------------------- src/variable_container.js | 1 + 3 files changed, 154 insertions(+), 151 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index f461ced62c..b0f5764ec0 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -356,7 +356,7 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_eye_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftEye = e : ("RIGHT" != d && (c.leftEye = e), c.rightEye = e); return a.callReturn(); }; @@ -667,7 +667,7 @@ Blockly.Blocks.albert_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "FRONT" == d ? (c.leftEye = e, c.rightEye = e) : "LEFT" == d ? c.leftEye = e : c.rightEye = e; return a.callReturn(); }; @@ -774,7 +774,7 @@ Entry.block.arduino_get_number = function(b, a) { d.open("POST", "http://localhost:23518/arduino/", !1); d.send(String(c)); Entry.assert(200 == d.status, "arduino is not connected"); - return +d.responseText; + return Number(d.responseText); }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -1639,7 +1639,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() { this.setInputsInline(!0); }}; Entry.block.coordinate_mouse = function(b, a) { - return "x" === a.getField("VALUE", a) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y; + return "x" === a.getField("VALUE", a) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y); }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1663,7 +1663,7 @@ Entry.block.coordinate_object = function(b, a) { var d = c.parent, d = d.pictures; return d.indexOf(c.picture) + 1; case "size": - return +c.getSize().toFixed(1); + return Number(c.getSize().toFixed(1)); case "picture_name": return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name; } @@ -2806,7 +2806,7 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_following_speed_to = function(b, a) { - Entry.hw.sendQueue.lineTracerSpeed = +a.getField("SPEED", a); + Entry.hw.sendQueue.lineTracerSpeed = Number(a.getField("SPEED", a)); return a.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { @@ -2832,7 +2832,7 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_led_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = +a.getField("COLOR", a); + var c = Entry.hw.sendQueue, d = a.getField("DIRECTION", a), e = Number(a.getField("COLOR", a)); "LEFT" == d ? c.leftLed = e : ("RIGHT" != d && (c.leftLed = e), c.rightLed = e); return a.callReturn(); }; @@ -3031,7 +3031,7 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_port_to = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = +a.getField("MODE", a); + var c = Entry.hw.sendQueue, d = a.getField("PORT", a), e = Number(a.getField("MODE", a)); "A" == d ? c.ioModeA = e : ("B" != d && (c.ioModeA = e), c.ioModeB = e); return a.callReturn(); }; @@ -3080,7 +3080,7 @@ Blockly.Blocks.is_press_some_key = {init:function() { this.setInputsInline(!0); }}; Entry.block.is_press_some_key = function(b, a) { - var c = +a.getField("VALUE", a); + var c = Number(a.getField("VALUE", a)); return 0 <= Entry.pressedKeys.indexOf(c); }; Blockly.Blocks.reach_something = {init:function() { @@ -3294,13 +3294,13 @@ Entry.block.boolean_basic_operator = function(b, a) { case "EQUAL": return d == e; case "GREATER": - return +d > +e; + return Number(d) > Number(e); case "LESS": - return +d < +e; + return Number(d) < Number(e); case "GREATER_OR_EQUAL": - return +d >= +e; + return Number(d) >= Number(e); case "LESS_OR_EQUAL": - return +d <= +e; + return Number(d) <= Number(e); } }; Blockly.Blocks.show = {init:function() { @@ -3782,7 +3782,7 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { }}; Entry.block.rotate_by_angle_dropdown = function(b, a) { var c = a.getField("VALUE", a); - b.setRotation(b.getRotation() + +c); + b.setRotation(b.getRotation() + Number(c)); return a.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { @@ -3874,8 +3874,8 @@ Blockly.Blocks.locate = {init:function() { Entry.block.locate = function(b, a) { var c = a.getField("VALUE", a), d; "mouse" == c ? (c = Entry.stage.mouseCoordinate.x, d = Entry.stage.mouseCoordinate.y) : (d = Entry.container.getEntity(c), c = d.getX(), d = d.getY()); - b.setX(+c); - b.setY(+d); + b.setX(Number(c)); + b.setY(Number(d)); b.brush && !b.brush.stop && b.brush.lineTo(c, -1 * d); return a.callReturn(); }; @@ -4071,7 +4071,7 @@ Entry.block.locate_object_time = function(b, a) { if (0 != c) { "mouse" == d ? (d = e.x - b.getX(), e = e.y - b.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - b.getX(), e = e.getY() - b.getY()), a.isStart = !0, a.frameCount = c, a.dX = d / a.frameCount, a.dY = e / a.frameCount; } else { - return "mouse" == d ? (d = +e.x, e = +e.y) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); + return "mouse" == d ? (d = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), b.setX(d), b.setY(e), b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()), a.callReturn(); } } if (0 != a.frameCount) { @@ -8190,7 +8190,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; g.onblur = function(a) { - isNaN(g.value) || c.entity.setX(+g.value); + isNaN(g.value) || c.entity.setX(Number(g.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8198,7 +8198,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; k.onblur = function(a) { - isNaN(k.value) || c.entity.setY(+k.value); + isNaN(k.value) || c.entity.setY(Number(k.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8206,7 +8206,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; n.onblur = function(a) { - isNaN(n.value) || c.entity.setSize(+n.value); + isNaN(n.value) || c.entity.setSize(Number(n.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8250,7 +8250,7 @@ Entry.EntryObject.prototype.generateView = function() { m.onblur = function(a) { a = m.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setRotation(+a); + isNaN(a) || c.entity.setRotation(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8260,7 +8260,7 @@ Entry.EntryObject.prototype.generateView = function() { q.onblur = function(a) { a = q.value; -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setDirection(+a); + isNaN(a) || c.entity.setDirection(Number(a)); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8332,24 +8332,24 @@ Entry.EntryObject.prototype.generateView = function() { } }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"), m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) { - 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(+a), c.updateRotationView(), m.blur()); + 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur()); }, m.onblur = function(a) { c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); }, q.onkeypress = function(a) { - 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(+a), c.updateRotationView(), q.blur()); + 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur()); }, q.onblur = function(a) { c.entity.setDirection(c.entity.getDirection()); Entry.stage.updateObject(); }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"), h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n), d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(+g.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); }, g.onblur = function(a) { c.entity.setX(c.entity.getX()); Entry.stage.updateObject(); }, k.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(+k.value), c.updateCoordinateView(), c.blur()); + 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); }, k.onblur = function(a) { c.entity.setY(c.entity.getY()); Entry.stage.updateObject(); @@ -10284,7 +10284,7 @@ Entry.Parser = function(b, a, c) { this.codeMirror = c; this._lang = a || "js"; this.availableCode = []; - "maze" === b && (this._stageId = +Ntry.configManager.getConfig("stageId"), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); + "maze" === b && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); this.mappingSyntax(b); switch(this._lang) { case "js": @@ -10980,7 +10980,7 @@ p = Entry.Script.prototype; p.init = function(b, a, c) { Entry.assert("BLOCK" == b.tagName.toUpperCase(), b.tagName); this.type = b.getAttribute("type"); - this.id = +b.getAttribute("id"); + this.id = Number(b.getAttribute("id")); b.getElementsByTagName("mutation").length && b.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = b.childNodes[0].getAttribute("hashid")); "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); a instanceof Entry.Script && (this.previousScript = a, a.parentScript && (this.parentScript = a.parentScript)); @@ -11044,7 +11044,7 @@ p.getValue = function(b) { return this.values[b].run(); }; p.getNumberValue = function(b) { - return +this.values[b].run(); + return Number(this.values[b].run()); }; p.getStringValue = function(b) { return String(this.values[b].run()); @@ -11059,7 +11059,7 @@ p.getStringField = function(b) { return String(this.fields[b]); }; p.getNumberField = function(b) { - return +this.fields[b]; + return Number(this.fields[b]); }; p.callReturn = function() { return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; @@ -12007,7 +12007,7 @@ Entry.getElementsByClassName = function(b) { return a; }; Entry.parseNumber = function(b) { - return "string" != typeof b || isNaN(+b) ? "number" != typeof b || isNaN(+b) ? !1 : b : +b; + return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b); }; Entry.countStringLength = function(b) { var a, c = 0; @@ -12073,7 +12073,7 @@ Entry.computeInputWidth = function(b) { document.body.appendChild(a); b = a.offsetWidth; document.body.removeChild(a); - return +(b + 10) + "px"; + return Number(b + 10) + "px"; }; Entry.isArrowOrBackspace = function(b) { return -1 < [37, 38, 39, 40, 8].indexOf(b); @@ -12238,7 +12238,7 @@ Entry.getMaxFloatPoint = function(b) { return Math.min(a, 20); }; Entry.convertToRoundedDecimals = function(b, a) { - return isNaN(b) || !this.isFloat(b) ? b : +(Math.round(b + "e" + a) + "e-" + a); + return isNaN(b) || !this.isFloat(b) ? b : Number(Math.round(b + "e" + a) + "e-" + a); }; Entry.attachEventListener = function(b, a, c) { setTimeout(function() { @@ -12597,7 +12597,7 @@ Entry.Func.generateBlock = function(b) { var a = {template:b.template, params:b.params}, c = /(%\d)/mi, d = b.template.split(c), e = "", f = 0, g = 0, h; for (h in d) { var k = d[h]; - c.test(k) ? (k = +k.split("%")[1] - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; + c.test(k) ? (k = Number(k.split("%")[1]) - 1, k = b.params[k], "Indicator" !== k.type && ("boolean" === k.accept ? (e += Lang.template.function_param_boolean + (f ? f : ""), f++) : (e += Lang.General.param_string + (g ? g : ""), g++))) : e += k; } return {block:a, description:e}; }; @@ -12990,7 +12990,7 @@ p.removePortReadable = function(b) { var a, c; for (c in this.sendQueue.readablePorts) { if (this.sendQueue.readablePorts[c] == b) { - a = +c; + a = Number(c); break; } } @@ -13056,7 +13056,7 @@ Entry.Variable = function(b) { this.isCloud_ = b.isCloud || !1; var a = Entry.parseNumber(b.value); this.value_ = "number" == typeof a ? a : b.value ? b.value : 0; - "slide" == this.type && (this.minValue_ = +(b.minValue ? b.minValue : 0), this.maxValue_ = +(b.maxValue ? b.maxValue : 100)); + "slide" == this.type && (this.minValue_ = Number(b.minValue ? b.minValue : 0), this.maxValue_ = Number(b.maxValue ? b.maxValue : 100)); b.isClone || (this.visible_ = b.visible || "boolean" == typeof b.visible ? b.visible : !0, this.x_ = b.x ? b.x : null, this.y_ = b.y ? b.y : null, "list" == this.type && (this.width_ = b.width ? b.width : 100, this.height_ = b.height ? b.height : 120, this.array_ = b.array ? b.array : [], this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); }; Entry.Variable.prototype.generateView = function(b) { @@ -13225,13 +13225,13 @@ Entry.Variable.prototype.getId = function() { return this.id_; }; Entry.Variable.prototype.getValue = function() { - return this.isNumber() ? +this.value_ : this.value_; + return this.isNumber() ? Number(this.value_) : this.value_; }; Entry.Variable.prototype.isNumber = function() { return isNaN(this.value_) ? !1 : !0; }; Entry.Variable.prototype.setValue = function(b) { - "slide" != this.type ? this.value_ = b : (b = +b, this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); + "slide" != this.type ? this.value_ = b : (b = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); this.isCloud_ && Entry.variableContainer.updateCloudVariables(); this.updateView(); }; @@ -13333,7 +13333,7 @@ Entry.Variable.prototype.updateSlideValueByView = function() { var b = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; 0 > b && (b = 0); 1 < b && (b = 1); - var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Math.abs(c - a) * b).toFixed(2), b = parseFloat(b); + var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + Number(Math.abs(c - a) * b)).toFixed(2), b = parseFloat(b); b < a ? b = this.minValue_ : b > c && (b = this.maxValue_); this.isFloatPoint() || (b = Math.round(b)); this.setValue(b); @@ -13873,6 +13873,7 @@ Entry.VariableContainer.prototype.addMessage = function(b) { this.messages_.unshift(b); Entry.playground.reloadPlayground(); this.updateList(); + b.listElement.nameField.focus(); return new Entry.State(this, this.removeMessage, b); }; Entry.VariableContainer.prototype.removeMessage = function(b) { @@ -14521,7 +14522,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) { c.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.setListLength = function(b) { - b = +b; + b = Number(b); var a = this.selectedList.array_; if (!isNaN(b)) { var c = a.length; @@ -15306,7 +15307,7 @@ Entry.BlockMenu = function(b, a, c, d) { if (isNaN(a)) { return a; } - a = +a; + a = Number(a); for (var b = this._categories, d = this._categoryElems, e = 0;e < b.length;e++) { var f = b[e]; if (!d[f].hasClass("entryRemove") && 0 === a--) { @@ -15668,7 +15669,7 @@ Entry.BlockView.DRAG_RADIUS = 5; var h = e[g].trim(); if (0 !== h.length) { if (d.test(h)) { - var k = +h.split("%")[1] - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); + var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); this._contents.push(h); this._paramMap[k] = h; } else { @@ -16418,10 +16419,10 @@ Entry.Scope = function(b, a) { return String(this.getValue(a, b)); }; b.getNumberValue = function(a, b) { - return +this.getValue(a); + return Number(this.getValue(a)); }; b.getBooleanValue = function(a, b) { - return +this.getValue(a, b) ? !0 : !1; + return Number(this.getValue(a, b)) ? !0 : !1; }; b.getField = function(a, b) { return this.block.params[this._getParamIndex(a)]; @@ -16430,7 +16431,7 @@ Entry.Scope = function(b, a) { return String(this.getField(a)); }; b.getNumberField = function(a) { - return +this.getField(a); + return Number(this.getField(a)); }; b.getStatement = function(a, b) { return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); @@ -19095,7 +19096,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; return this.mode; }; b.setMode = function(a, b) { - a = +a; + a = Number(a); var d = this.mode; this.mode = a; switch(a) { @@ -20134,7 +20135,7 @@ Entry.Xml.getNumberValue = function(b, a, c) { } for (var d in c) { if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == a) { - return +Entry.Xml.operate(b, c[d].children[0]); + return Number(Entry.Xml.operate(b, c[d].children[0])); } } return null; @@ -20157,7 +20158,7 @@ Entry.Xml.getNumberField = function(b, a) { } for (var d in c) { if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return +c[d].textContent; + return Number(c[d].textContent); } } }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 6ac2d63c65..0a1e9acee8 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -32,7 +32,7 @@ Blockly.Blocks.albert_stop={init:function(){this.setColour("#00979D");this.appen Blockly.Blocks.albert_set_pad_size_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_1);this.appendValueInput("WIDTH").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_2);this.appendValueInput("HEIGHT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_pad_size_to=function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}; Blockly.Blocks.albert_clear_eye={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_eye_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_eye=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}; Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.turn_on,"ON"],[Lang.General.turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_body_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -62,7 +62,7 @@ Entry.block.albert_move_backward=function(b,a){var c=Entry.hw.sendQueue;if(a.isS Blockly.Blocks.albert_turn_around={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_around_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_around_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_turn_around=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a);a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}; Blockly.Blocks.albert_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.General.skyblue,"3"],[Lang.General.blue,"1"],[Lang.General.purple, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}; Blockly.Blocks.albert_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}; Blockly.Blocks.albert_change_wheels_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_change_wheels_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheels_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ @@ -76,7 +76,7 @@ Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entr Blockly.Blocks.arduino_send={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_send_2);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.arduino_send=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}; Blockly.Blocks.arduino_get_string={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_string_2);this.setOutput(!0,"String");this.setInputsInline(!0)}}; -Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}; +Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}; Blockly.Blocks.arduino_get_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_arduino_get_number_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.arduino_get_string=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}; Blockly.Blocks.arduino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_arduino_get_sensor_number_0,"A0"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_1,"A1"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_2,"A2"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_3,"A3"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_4,"A4"],[Lang.Blocks.ARDUINO_arduino_get_sensor_number_5,"A5"]]),"PORT");this.appendDummyInput().appendField(" "); @@ -181,10 +181,10 @@ Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockC Entry.block.get_rotation_direction=function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.distance_something={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_distance_something_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_distance_something_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.distance_something=function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}; -Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; Blockly.Blocks.calc_basic={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["String","Number"]);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_basic=function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e};Blockly.Blocks.calc_plus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("+",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; Entry.block.calc_plus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d};Blockly.Blocks.calc_minus={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("-",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; @@ -304,10 +304,10 @@ Blockly.Blocks.hamster_follow_line_until={init:function(){this.setColour("#00979 Entry.block.hamster_follow_line_until=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, g);return a}; Blockly.Blocks.hamster_set_following_speed_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_following_speed_to_1).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]]),"SPEED").appendField(Lang.Blocks.HAMSTER_set_following_speed_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED",a);return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.hamster_set_following_speed_to=function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED",a));return a.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_stop=function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}; Blockly.Blocks.hamster_set_led_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_led_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"], -[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}; Blockly.Blocks.hamster_clear_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_clear_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_clear_led=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()};Blockly.Blocks.hamster_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_beep=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}; @@ -328,12 +328,12 @@ Entry.block.hamster_change_tempo_by=function(b,a){Entry.Hamster.tempo+=a.getNumb Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(b,a){Entry.Hamster.tempo=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; Blockly.Blocks.hamster_set_port_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_port_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_port_to_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"], -[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; +[Lang.Blocks.HAMSTER_pwm_output,"9"],[Lang.Blocks.HAMSTER_digital_output,"10"]]),"MODE").appendField(Lang.Blocks.HAMSTER_set_port_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_port_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=Number(a.getField("MODE",a));"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}; Blockly.Blocks.hamster_change_output_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_change_output_by_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_output_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}; Blockly.Blocks.hamster_set_output_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]]),"PORT").appendField(Lang.Blocks.HAMSTER_set_output_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_output_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; -Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=Number(a.getField("VALUE",a));return 0<=Entry.pressedKeys.indexOf(c)}; Blockly.Blocks.reach_something={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("collision"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_reach_something_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; Entry.block.reach_something=function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE",a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"== c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; +Entry.block.boolean_basic_operator=function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}};Blockly.Blocks.show={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_show).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.show=function(b,a){b.setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_hide).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hide=function(b,a){b.setVisible(!1);return a.callReturn()}; Blockly.Blocks.dialog_time={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_2);this.appendValueInput("SECOND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_3);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION"); this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -400,7 +400,7 @@ Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_by_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}; Blockly.Blocks.rotate_by_angle_dropdown={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["45","45"],["90","90"],["135","135"],["180","180"]]),"VALUE").appendField(Lang.Blocks.MOVING_rotate_by_angle_dropdown_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}; Blockly.Blocks.see_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.see_angle=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.see_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -412,7 +412,7 @@ Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b Blockly.Blocks.locate_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.locate_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; +Entry.block.locate=function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}; Blockly.Blocks.move_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_xy_time_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.move_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; @@ -438,8 +438,8 @@ Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this. Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.locate_object_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_object_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&& -b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_object_time=function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE",a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&& +!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.rotate_absolute={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_set_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}; Blockly.Blocks.rotate_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -825,25 +825,26 @@ d.object=this;this.editView_=d;this.view_.appendChild(d);Entry.objectEditable?($ d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)}));d=Entry.createElement("div");d.addClass("entryObjectInformationWorkspace");d.object=this;this.isInformationToggle=!1;b.appendChild(d);this.informationView_=d;b=Entry.createElement("div");b.addClass("entryObjectRotationWrapperWorkspace");b.object=this;this.view_.appendChild(b);d=Entry.createElement("span");d.addClass("entryObjectCoordinateWorkspace"); b.appendChild(d);e=Entry.createElement("span");e.addClass("entryObjectCoordinateSpanWorkspace");e.innerHTML="X:";var g=Entry.createElement("input");g.addClass("entryObjectCoordinateInputWorkspace");g.setAttribute("readonly",!0);g.bindOnClick(function(a){a.stopPropagation();this.select()});var h=Entry.createElement("span");h.addClass("entryObjectCoordinateSpanWorkspace");h.innerHTML="Y:";var k=Entry.createElement("input");k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); k.bindOnClick(function(a){a.stopPropagation();this.select()});k.setAttribute("readonly",!0);var l=Entry.createElement("span");l.addClass("entryObjectCoordinateSizeWorkspace");l.innerHTML=Lang.Workspace.Size+" : ";var n=Entry.createElement("input");n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size");n.bindOnClick(function(a){a.stopPropagation();this.select()});n.setAttribute("readonly",!0);d.appendChild(e);d.appendChild(g);d.appendChild(h);d.appendChild(k); -d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(+g.value);c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(+k.value);c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)}; -n.onblur=function(a){isNaN(n.value)||c.entity.setSize(+n.value);c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly",!0);m.bindOnClick(function(a){a.stopPropagation(); -this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_=m;d.directionInput_=q;c=this;m.onkeypress=function(a){13== -a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(+a);c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(+a);c.updateRotationView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper"); -b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))}); -b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b); -b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id),b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&& -Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])),this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"), -d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"),b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this, -this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.container.removeObject(this.object)})),d=Entry.createElement("button"), -d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"),this.view_.appendChild(d),this.rotateLabelWrapperView_= -d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_=q,d.appendChild(e),d.appendChild(m),d.appendChild(h), -d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(+a),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setDirection(+a),c.updateRotationView(), -q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"),g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"), -h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"),d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l), -d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(+g.value),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(+k.value),c.updateCoordinateView(),c.blur())},k.onblur=function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"), -d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"), -b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}), -this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b};Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; +d.appendChild(l);d.appendChild(n);d.xInput_=g;d.yInput_=k;d.sizeInput_=n;this.coordinateView_=d;c=this;g.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};g.onblur=function(a){isNaN(g.value)||c.entity.setX(Number(g.value));c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};k.onblur=function(a){isNaN(k.value)||c.entity.setY(Number(k.value));c.updateCoordinateView();Entry.stage.updateObject()};n.onkeypress=function(a){13== +a.keyCode&&c.editObjectValues(!1)};n.onblur=function(a){isNaN(n.value)||c.entity.setSize(Number(n.value));c.updateCoordinateView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("entryObjectRotateLabelWrapperWorkspace");this.view_.appendChild(d);this.rotateLabelWrapperView_=d;e=Entry.createElement("span");e.addClass("entryObjectRotateSpanWorkspace");e.innerHTML=Lang.Workspace.rotation+" : ";var m=Entry.createElement("input");m.addClass("entryObjectRotateInputWorkspace");m.setAttribute("readonly", +!0);m.bindOnClick(function(a){a.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var q=Entry.createElement("input");q.addClass("entryObjectDirectionInputWorkspace");q.setAttribute("readonly",!0);q.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=q;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(q);d.rotateInput_= +m;d.directionInput_=q;c=this;m.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(Number(a));c.updateRotationView();Entry.stage.updateObject()};q.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)};q.onblur=function(a){a=q.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(Number(a));c.updateRotationView(); +Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper");b.appendChild(d);this.rotationMethodWrapper_=d;b=Entry.createElement("span");b.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(b);b.innerHTML=Lang.Workspace.rotate_method+" : ";b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeAWorkspace");b.object=this;this.rotateModeAView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")|| +this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace");b.addClass("entryObjectRotateModeBWorkspace");b.object=this;this.rotateModeBView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"),this.object.setRotateMethod("vertical"))});b=Entry.createElement("div");b.addClass("entryObjectRotateModeWorkspace"); +b.addClass("entryObjectRotateModeCWorkspace");b.object=this;this.rotateModeCView_=b;d.appendChild(b);b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("none"),this.object.setRotateMethod("none"))});this.updateThumbnailView();this.updateCoordinateView();this.updateRotateMethodView();this.updateInputViews();this.updateCoordinateView(!0);this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=Entry.createElement("li",this.id), +b.addClass("entryContainerListElementWorkspace"),b.object=this,b.bindOnClick(function(a){Entry.container.getObject(this.id)&&Entry.container.selectObject(this.id)}),$&&(a=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(a){a.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(b){b.preventDefault();Entry.container.addCloneObject(a)}},{text:Lang.Workspace.context_remove,href:"/",action:function(b){b.preventDefault();Entry.container.removeObject(a)}}])), +this.view_=b,b=Entry.createElement("ul"),b.addClass("objectInfoView"),d=Entry.createElement("li"),d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectInfo_lock"),b.appendChild(d),b.appendChild(e),this.view_.appendChild(b),b=Entry.createElement("div"),b.addClass("entryObjectThumbnailWorkspace"),this.view_.appendChild(b),this.thumbnailView_=b,b=Entry.createElement("div"),b.addClass("entryObjectWrapperWorkspace"),this.view_.appendChild(b),d=Entry.createElement("input"),d.addClass("entryObjectNameWorkspace"), +b.appendChild(d),this.nameView_=d,this.nameView_.entryObject=this,this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(!1)},this.nameView_.value=this.name,Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeletePhone"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(a){Entry.engine.isState("run")|| +Entry.container.removeObject(this.object)})),d=Entry.createElement("button"),d.addClass("entryObjectEditPhone"),d.object=this,d.bindOnClick(function(a){if(a=Entry.container.getObject(this.id))Entry.container.selectObject(a.id),Entry.playground.injectObject(a)}),this.view_.appendChild(d),d=Entry.createElement("div"),d.addClass("entryObjectInformationWorkspace"),d.object=this,this.isInformationToggle=!1,b.appendChild(d),this.informationView_=d,d=Entry.createElement("div"),d.addClass("entryObjectRotateLabelWrapperWorkspace"), +this.view_.appendChild(d),this.rotateLabelWrapperView_=d,e=Entry.createElement("span"),e.addClass("entryObjectRotateSpanWorkspace"),e.innerHTML=Lang.Workspace.rotation+" : ",m=Entry.createElement("input"),m.addClass("entryObjectRotateInputWorkspace"),this.rotateSpan_=e,this.rotateInput_=m,h=Entry.createElement("span"),h.addClass("entryObjectDirectionSpanWorkspace"),h.innerHTML=Lang.Workspace.direction+" : ",q=Entry.createElement("input"),q.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_= +q,d.appendChild(e),d.appendChild(m),d.appendChild(h),d.appendChild(q),d.rotateInput_=m,d.directionInput_=q,c=this,m.onkeypress=function(a){13==a.keyCode&&(a=m.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))),isNaN(a)||c.entity.setRotation(Number(a)),c.updateRotationView(),m.blur())},m.onblur=function(a){c.entity.setRotation(c.entity.getRotation());Entry.stage.updateObject()},q.onkeypress=function(a){13==a.keyCode&&(a=q.value,-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da"))), +isNaN(a)||c.entity.setDirection(Number(a)),c.updateRotationView(),q.blur())},q.onblur=function(a){c.entity.setDirection(c.entity.getDirection());Entry.stage.updateObject()},b=Entry.createElement("div"),b.addClass("entryObjectRotationWrapperWorkspace"),b.object=this,this.view_.appendChild(b),d=Entry.createElement("span"),d.addClass("entryObjectCoordinateWorkspace"),b.appendChild(d),e=Entry.createElement("span"),e.addClass("entryObjectCoordinateSpanWorkspace"),e.innerHTML="X:",g=Entry.createElement("input"), +g.addClass("entryObjectCoordinateInputWorkspace"),h=Entry.createElement("span"),h.addClass("entryObjectCoordinateSpanWorkspace"),h.innerHTML="Y:",k=Entry.createElement("input"),k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),l=Entry.createElement("span"),l.addClass("entryObjectCoordinateSpanWorkspace"),l.innerHTML=Lang.Workspace.Size,n=Entry.createElement("input"),n.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"), +d.appendChild(e),d.appendChild(g),d.appendChild(h),d.appendChild(k),d.appendChild(l),d.appendChild(n),d.xInput_=g,d.yInput_=k,d.sizeInput_=n,this.coordinateView_=d,c=this,g.onkeypress=function(a){13==a.keyCode&&(isNaN(g.value)||c.entity.setX(Number(g.value)),c.updateCoordinateView(),c.blur())},g.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},k.onkeypress=function(a){13==a.keyCode&&(isNaN(k.value)||c.entity.setY(Number(k.value)),c.updateCoordinateView(),c.blur())},k.onblur= +function(a){c.entity.setY(c.entity.getY());Entry.stage.updateObject()},d=Entry.createElement("div"),d.addClass("rotationMethodWrapper"),b.appendChild(d),this.rotationMethodWrapper_=d,b=Entry.createElement("span"),b.addClass("entryObjectRotateMethodLabelWorkspace"),d.appendChild(b),b.innerHTML=Lang.Workspace.rotate_method+" : ",b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeAWorkspace"),b.object=this,this.rotateModeAView_=b,d.appendChild(b), +b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("free")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeBWorkspace"),b.object=this,this.rotateModeBView_=b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("vertical")}),b=Entry.createElement("div"),b.addClass("entryObjectRotateModeWorkspace"),b.addClass("entryObjectRotateModeCWorkspace"),b.object=this,this.rotateModeCView_= +b,d.appendChild(b),b.bindOnClick(function(a){Entry.engine.isState("run")||this.object.setRotateMethod("none")}),this.updateThumbnailView(),this.updateCoordinateView(),this.updateRotateMethodView(),this.updateInputViews(),this.view_};Entry.EntryObject.prototype.setName=function(b){Entry.assert("string"==typeof b,"object name must be string");this.name=b;this.nameView_.value=b};Entry.EntryObject.prototype.setText=function(b){Entry.assert("string"==typeof b,"object text must be string");this.text=b}; +Entry.EntryObject.prototype.setScript=function(b){this.script=b};Entry.EntryObject.prototype.getScriptText=function(){return JSON.stringify(this.script.toJSON())}; Entry.EntryObject.prototype.initEntity=function(b){var a={};a.x=a.y=0;a.rotation=0;a.direction=90;if("sprite"==this.objectType){var c=b.sprite.pictures[0].dimension;a.regX=c.width/2;a.regY=c.height/2;a.scaleX=a.scaleY="background"==b.sprite.category.main?Math.max(270/c.height,480/c.width):"new"==b.sprite.category.main?1:200/(c.width+c.height);a.width=c.width;a.height=c.height}else if("textBox"==this.objectType)if(a.regX=25,a.regY=12,a.scaleX=a.scaleY=1.5,a.width=50,a.height=24,a.text=b.text,b.options){if(b= b.options,c="",b.bold&&(c+="bold "),b.italic&&(c+="italic "),a.underline=b.underline,a.strike=b.strike,a.font=c+"20px "+b.font.family,a.colour=b.colour,a.bgColor=b.background,a.lineBreak=b.lineBreak)a.width=256,a.height=.5625*a.width,a.regX=a.width/2,a.regY=a.height/2}else a.underline=!1,a.strike=!1,a.font="20px Nanum Gothic",a.colour="#000000",a.bgColor="#ffffff";return a}; Entry.EntryObject.prototype.updateThumbnailView=function(){if("sprite"==this.objectType)if(this.entity.picture.fileurl)this.thumbnailView_.style.backgroundImage='url("'+this.entity.picture.fileurl+'")';else{var b=this.entity.picture.filename;this.thumbnailView_.style.backgroundImage='url("'+Entry.defaultPath+"/uploads/"+b.substring(0,2)+"/"+b.substring(2,4)+"/thumb/"+b+'.png")'}else"textBox"==this.objectType&&(this.thumbnailView_.style.backgroundImage="url("+(Entry.mediaFilePath+"/text_icon.png")+ @@ -1004,7 +1005,7 @@ node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294 node:a};};b.initScope=function(a){if(null===this.scope){var b=function(){};b.prototype=this.syntax.Scope}else b=function(){},b.prototype=this.scope;this.scope=new b;this.scopeChain.push(this.scope);return this.scanDefinition(a)};b.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};b.scanDefinition=function(a){a=a.body;for(var b=[],d=0;d=b.keyCode&&CodeMirror.showHint(a,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; (function(b){b.parse=function(a){var b=null;switch(this._lang){case "js":try{var d=acorn.parse(a),b=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(a={from:{line:e.loc.line-1,ch:e.loc.column-2},to:{line:e.loc.line-1,ch:e.loc.column+1}},e.message="\ubb38\ubc95 \uc624\ub958\uc785\ub2c8\ub2e4."):(a=this.getLineNumber(e.node.start,e.node.end),a.message=e.message,a.severity="error",this.codeMirror.markText(a.from,a.to,{className:"CodeMirror-lint-mark-error",__annotation:a, clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),b=[]}break;case "block":a=this._parser.Code(a).match(/(.*{.*[\S|\s]+?}|.+)/g),b=Array.isArray(a)?a.reduce(function(a,b,c){var d="";1===c&&(a+="\n");d=-1=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"), $(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; -p.init=function(b,a,c){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=+b.getAttribute("id");b.getElementsByTagName("mutation").length&&b.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=b.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);a instanceof Entry.Script&&(this.previousScript=a,a.parentScript&&(this.parentScript=a.parentScript));c instanceof Entry.Script&&(this.parentScript= -c);b=b.childNodes;for(a=0;a=f?(parseFloat(b)+parseFloat(a)).toFixed(e):(parseFloat(b)+parseFloat(a)).toFixed(f):parseInt(b)+parseInt(a)}; Entry.hex2rgb=function(b){return(b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(b))?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null};Entry.rgb2hex=function(b,a,c){return"#"+(16777216+(b<<16)+(a<<8)+c).toString(16).slice(1)};Entry.generateRgb=function(){return{r:Math.floor(256*Math.random()),g:Math.floor(256*Math.random()),b:Math.floor(256*Math.random())}};Entry.adjustValueWithMaxMin=function(b,a,c){return b>c?c:ba.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; -Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return+(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;c/g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return Number(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cd&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:+(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; +Entry.getMaxFloatPoint=function(b){for(var a=0,c=0,d=b.length;ca&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; Entry.isEmpty=function(b){if(!b)return!0;for(var a in b)if(b.hasOwnProperty(a))return!1;return!0};Entry.Utils.disableContextmenu=function(b){if(b)$(b).on("contextmenu",function(a){a.stopPropagation();a.preventDefault();return!1})};Entry.Utils.isRightButton=function(b){return 2==b.button||b.ctrlKey};Entry.Utils.isTouchEvent=function(b){return"mousedown"!==b.type.toLowerCase()};Entry.Utils.inherit=function(b,a){function c(){}c.prototype=b.prototype;a.prototype=new c;return a}; Entry.bindAnimationCallbackOnce=function(b,a){b.one("webkitAnimationEnd animationendo animationend",a)};Entry.Utils.isInInput=function(b){return"textarea"==b.target.type||"text"==b.target.type};Entry.Utils.isFunction=function(b){return"function"===typeof b}; Entry.Utils.addFilters=function(b,a){var c=b.elem("defs"),d=c.elem("filter",{id:"entryTrashcanFilter_"+a});d.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});d.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});d=d.elem("feMerge");d.elem("feMergeNode",{"in":"offsetBlur"});d.elem("feMergeNode",{"in":"SourceGraphic"},d);d=c.elem("filter",{id:"entryBlockShadowFilter_"+a,height:"200%"});d.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});d.elem("feColorMatrix", @@ -1168,7 +1169,7 @@ Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.me Entry.Func.requestParamBlock=function(b){var a=Entry.generateHash(),c;switch(b){case "string":c=Entry.block.function_param_string;break;case "boolean":c=Entry.block.function_param_boolean;break;default:return null}a=b+"Param_"+a;b=Entry.Func.createParamBlock(a,c,b);Entry.block[a]=b;return a}; Entry.Func.registerParamBlock=function(b){-1=Entry.HW.TRIAL_LIMIT)this.isFi JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)}.bind(this),a.onclose=function(){"WebSocket"===b.socketType&&(this.socket=null,b.initSocket())}}catch(d){}try{c=new WebSocket("wss://hardware.play-entry.org:23518")}catch(d){}}c.binaryType="arraybuffer";c.onopen=function(){b.socketType="WebSocketSecurity";b.initHardware(c)};c.onmessage=function(a){a=JSON.parse(a.data);b.checkDevice(a);b.updatePortData(a)};c.onclose=function(){"WebSocketSecurity"===b.socketType&&(this.socket=null,b.initSocket())}; Entry.dispatchEvent("hwChanged")}}catch(d){}};p.retryConnect=function(){this.connectTrial=0;this.initSocket()};p.initHardware=function(b){this.socket=b;this.connectTrial=0;this.connected=!0;Entry.dispatchEvent("hwChanged");Entry.playground&&Entry.playground.object&&Entry.playground.setMenu(Entry.playground.object.objectType)};p.setDigitalPortValue=function(b,a){this.sendQueue[b]=a;this.removePortReadable(b)};p.getAnalogPortValue=function(b){return this.connected?this.portData["a"+b]:0}; p.getDigitalPortValue=function(b){if(!this.connected)return 0;this.setPortReadable(b);return void 0!==this.portData[b]?this.portData[b]:0};p.setPortReadable=function(b){this.sendQueue.readablePorts||(this.sendQueue.readablePorts=[]);var a=!1,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=!0;break}a||this.sendQueue.readablePorts.push(b)}; -p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=+c;break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; +p.removePortReadable=function(b){if(this.sendQueue.readablePorts||Array.isArray(this.sendQueue.readablePorts)){var a,c;for(c in this.sendQueue.readablePorts)if(this.sendQueue.readablePorts[c]==b){a=Number(c);break}this.sendQueue.readablePorts=void 0!=a?this.sendQueue.readablePorts.slice(0,a).concat(this.sendQueue.readablePorts.slice(a+1,this.sendQueue.readablePorts.length)):[]}};p.update=function(){this.socket&&1==this.socket.readyState&&this.socket.send(JSON.stringify(this.sendQueue))}; p.updatePortData=function(b){this.portData=b;this.hwMonitor&&this.hwMonitor.update()};p.closeConnection=function(){this.socket&&this.socket.close()};p.downloadConnector=function(){window.open("http://download.play-entry.org/apps/Entry_HW_1.5.3_Setup.exe","_blank").focus()};p.downloadSource=function(){window.open("http://play-entry.com/down/board.ino","_blank").focus()};p.setZero=function(){Entry.hw.hwModule&&Entry.hw.hwModule.setZero()}; p.checkDevice=function(b){void 0!==b.company&&(b=""+b.company+b.model,b!=this.selectedDevice&&(this.selectedDevice=b,this.hwModule=this.hwInfo[b],Entry.dispatchEvent("hwChanged"),Entry.toast.success("\ud558\ub4dc\uc6e8\uc5b4 \uc5f0\uacb0 \uc131\uacf5","\ud558\ub4dc\uc6e8\uc5b4 \uc544\uc774\ucf58\uc744 \ub354\ube14\ud074\ub9ad\ud558\uba74, \uc13c\uc11c\uac12\ub9cc \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.",!0),this.hwModule.monitorTemplate&&(this.hwMonitor?(this.hwMonitor._hwModule=this.hwModule, -this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=+(b.minValue?b.minValue:0),this.maxValue_=+(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"==typeof b.visible? -b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Entry.propertyPanel.addMode("hw",this.hwMonitor),b=this.hwModule.monitorTemplate,"both"==b.mode?(b.mode="list",this.hwMonitor.generateListView(),b.mode="general",this.hwMonitor.generateView(),b.mode="both"):"list"==b.mode?this.hwMonitor.generateListView():this.hwMonitor.generateView())))};p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Variable=function(b){Entry.assert("string"==typeof b.name,"Variable name must be given");this.name_=b.name;this.id_=b.id?b.id:Entry.generateHash();this.type=b.variableType?b.variableType:"variable";this.object_=b.object||null;this.isCloud_=b.isCloud||!1;var a=Entry.parseNumber(b.value);this.value_="number"==typeof a?a:b.value?b.value:0;"slide"==this.type&&(this.minValue_=Number(b.minValue?b.minValue:0),this.maxValue_=Number(b.maxValue?b.maxValue:100));b.isClone||(this.visible_=b.visible||"boolean"== +typeof b.visible?b.visible:!0,this.x_=b.x?b.x:null,this.y_=b.y?b.y:null,"list"==this.type&&(this.width_=b.width?b.width:100,this.height_=b.height?b.height:120,this.array_=b.array?b.array:[],this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(b){var a=this.type;if("variable"==a||"timer"==a||"answer"==a)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",a=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(a){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", function(a){"workspace"==Entry.type&&(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==a){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= @@ -1220,15 +1221,15 @@ this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredW this.scrollPosition+b&&ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ 14,this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+ 15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1, -2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?+this.value_:this.value_}; -Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=+b,this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_}; +Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");(this.visible_=this.view_.visible=b)&&this.updateView()};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs(this.value_-a)/Math.abs(this.maxValue_-a)*b+10}; Entry.Variable.prototype.setSlideCommandX=function(b){var a=this.valueSetter_.graphics.command;b=Math.max("undefined"==typeof b?10:b,10);b=Math.min(this.maxWidth+10,b);a.x=b;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.updateSlideValueByView=function(){var b=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>b&&(b=0);1c&&(b=this.maxValue_);this.isFloatPoint()||(b=Math.round(b));this.setValue(b)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; Entry.Variable.prototype.setMinValue=function(b){this.minValue_=b;this.value_b&&(this.value_=b);this.updateView();this.isMaxFloat=Entry.isFloat(this.maxValue_)};Entry.Variable.prototype.isFloatPoint=function(){return this.isMaxFloat||this.isMinFloat};Entry.VariableContainer=function(){this.variables_=[];this.messages_=[];this.lists_=[];this.functions_={};this.viewMode_="all";this.selected=null;this.variableAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.listAddPanel={isOpen:!1,info:{object:null,isCloud:!1}};this.selectedVariable=null;this._variableRefs=[];this._messageRefs=[];this._functionRefs=[]}; Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; @@ -1276,7 +1277,7 @@ Entry.VariableContainer.prototype.createVariableView=function(b){var a=this,c=En e.bindOnClick(function(c){c.stopPropagation();a.removeVariable(b);a.selectedVariable=null;a.variableSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace"); g.addClass("entryRemove");g.bindOnClick(function(b){b.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(null,"variable")});c.editSaveButton=g;var h=Entry.createElement("input");h.addClass("entryVariableListElementNameWorkspace");h.setAttribute("disabled","disabled");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?a.changeVariableName(b, this.value):(Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.variable_can_not_space),this.value=b.getName())};h.onkeydown=function(a){13==a.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);b.listElement=c}; -Entry.VariableContainer.prototype.addMessage=function(b){b.id||(b.id=Entry.generateHash());Entry.stateManager&&Entry.stateManager.addCommand("add message",this,this.removeMessage,b);this.createMessageView(b);this.messages_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeMessage,b)}; +Entry.VariableContainer.prototype.addMessage=function(b){b.id||(b.id=Entry.generateHash());Entry.stateManager&&Entry.stateManager.addCommand("add message",this,this.removeMessage,b);this.createMessageView(b);this.messages_.unshift(b);Entry.playground.reloadPlayground();this.updateList();b.listElement.nameField.focus();return new Entry.State(this,this.removeMessage,b)}; Entry.VariableContainer.prototype.removeMessage=function(b){this.selected==b&&this.select(null);Entry.stateManager&&Entry.stateManager.addCommand("remove message",this,this.addMessage,b);var a=this.messages_.indexOf(b);this.messages_.splice(a,1);this.updateList();Entry.playground.reloadPlayground();return new Entry.State(this,this.addMessage,b)}; Entry.VariableContainer.prototype.changeMessageName=function(b,a){b.name!=a&&(Entry.isExist(a,"name",this.messages_)?(b.listElement.nameField.value=b.name,Entry.toast.alert(Lang.Workspace.message_rename_failed,Lang.Workspace.message_dup)):10b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +f.addClass("entryListSettingValueRemoveWorkspace");e.appendChild(f);d.appendChild(e)})(e);b.updateView();c.removeClass("entryRemove")};Entry.VariableContainer.prototype.setListLength=function(b){b=Number(b);var a=this.selectedList.array_;if(!isNaN(b)){var c=a.length;if(cb&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; @@ -1395,7 +1396,7 @@ VALUE:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Ent albert_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_stop",id:"4adb"},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}},albert_set_pad_size_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["108"]},{type:"text",params:["76"]},null],type:"albert_set_pad_size_to",id:"5mhg"},paramsKeyMap:{WIDTH:0,HEIGHT:1},"class":"albert_wheel",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;c.padWidth=a.getNumberValue("WIDTH");c.padHeight=a.getNumberValue("HEIGHT");return a.callReturn()}},albert_set_eye_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right, "RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"albert_set_eye_to"},paramsKeyMap:{DIRECTION:0,COLOR:1},"class":"albert_led",isNotFor:["albert"], -func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, +func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return a.callReturn()}},albert_clear_eye:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_clear_eye"}, paramsKeyMap:{DIRECTION:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.rightEye=0);return a.callReturn()}},albert_body_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_body_led"}, paramsKeyMap:{STATE:0},"class":"albert_led",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.bodyLed=1:c.bodyLed=0;return a.callReturn()}},albert_front_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\ucf1c\uae30","ON"],["\ub044\uae30","OFF"]],value:"ON",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"albert_front_led"},paramsKeyMap:{STATE:0},"class":"albert_led", isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;"ON"==a.getField("STATE",a)?c.frontLed=1:c.frontLed=0;return a.callReturn()}},albert_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_beep"},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue= @@ -1412,13 +1413,13 @@ statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12 img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=-30,c.rightWheel=-30,a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_turn_around:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"], ["\uc624\ub978\ucabd","RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return c.leftWheel=a.leftValue,c.rightWheel=a.rightValue,a;delete a.timeFlag;delete a.isStart;delete a.leftValue;delete a.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}c="LEFT"==a.getField("DIRECTION",a); a.leftValue=c?-30:30;a.rightValue=c?30:-30;a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[["\ube68\uac04\uc0c9","4"],["\ub178\ub780\uc0c9","6"],["\ucd08\ub85d\uc0c9","2"],["\ud558\ub298\uc0c9","3"],["\ud30c\ub780\uc0c9","1"],["\ubcf4\ub77c\uc0c9", -"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", +"5"],["\ud558\uc580\uc0c9","7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{DIRECTION:0,COLOR:1},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return a.callReturn()}},albert_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0},func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return a.callReturn()}},albert_change_wheels_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd", "LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("DIRECTION"),f=a.getNumberValue("VALUE");"LEFT"==e?c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f:d.leftWheel+f:("RIGHT"!=e&&(c.leftWheel=void 0!=c.leftWheel?c.leftWheel+f: d.leftWheel+f),c.rightWheel=void 0!=c.rightWheel?c.rightWheel+f:d.rightWheel+f);return a.callReturn()}},albert_set_wheels_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["\uc67c\ucabd","LEFT"],["\uc624\ub978\ucabd","RIGHT"],["\uc591\ucabd","FRONT"]],value:"LEFT",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{DIRECTION:0,VALUE:1},func:function(b,a){var c= Entry.hw.sendQueue,d=a.getField("DIRECTION"),e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e),c.rightWheel=e);return a.callReturn()}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(b,a){return a.getStringField("NAME")}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]}, paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return a.callReturn()}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/", -!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", +!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return Number(d.responseText)}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}},arduino_get_sensor_number:{color:"#00979D", skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","A0"],["1","A1"],["2","A2"],["3","A3"],["4","A4"],["5","A5"]],value:"A0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"], ["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{},def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_pwm_port_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]],value:"3",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}],events:{}, def:{params:[null]},paramsKeyMap:{PORT:0},func:function(b,a){return a.getStringField("PORT")}},arduino_get_number_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_sensor_number"}],type:"arduino_get_number_sensor_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}}, @@ -1478,17 +1479,17 @@ color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class": "ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],value:"ROTATION",fontSize:11}],events:{},def:{params:[null],type:"get_rotation_direction"},paramsKeyMap:{OPERATOR:0},"class":"calc",isNotFor:[],func:function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}},distance_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_distance_something_1, color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"},paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c); return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1}, -"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown", -options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1, -COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}},calc_basic:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number", -params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}},calc_plus:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}], -events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND", -a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/", -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", -text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, +"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"}, +{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"}, +paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}}, +calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]}, +"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}}, +calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"}, +{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND", +a),d=a.getNumberValue("RIGHTHAND",a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block", +accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[], +params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos, "acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural,"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}], events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(d)&&(1c))throw Error("x range exceeded");d.indexOf("_")&&(d=d.split("_")[0]);-1<["sin","cos","tan"].indexOf(d)&&(c=Entry.toRadian(c));var e=0;switch(d){case "square":e=c*c;break;case "factorial":e=Entry.factorial(c);break; case "root":e=Math.sqrt(c);break;case "log":e=Math.log(c)/Math.LN10;break;case "ln":e=Math.log(c);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[d](c));break;case "unnatural":e=c-Math.floor(c);0>c&&(e=1-e);break;default:e=Math[d](c)}return Math.round(1E3*e)/1E3}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2, @@ -1556,11 +1557,11 @@ e=a.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e) {type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_using"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("COLOR"),e=a.getField("DIRECTION"),f=1;"RIGHT"==e?f=2:"BOTH"==e&&(f=3);"WHITE"==d&&(f+=7);c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,f);return a.callReturn()}},hamster_follow_line_until:{color:"#00979D",skeleton:"basic", statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_color_black,"BLACK"],[Lang.General.white,"WHITE"]],value:"BLACK",fontSize:11},{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.Blocks.HAMSTER_front,"FRONT"],[Lang.Blocks.HAMSTER_rear,"REAR"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_follow_line_until"},paramsKeyMap:{COLOR:0,DIRECTION:1},"class":"hamster_wheel", isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=a.getField("COLOR"),f=a.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(a.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete a.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),a.callReturn()}else a.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, -g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=+a.getField("SPEED", -a);return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, +g);return a}},hamster_set_following_speed_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["5",null],type:"hamster_set_following_speed_to"},paramsKeyMap:{SPEED:0},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){Entry.hw.sendQueue.lineTracerSpeed=Number(a.getField("SPEED", +a));return a.callReturn()}},hamster_stop:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_stop"},"class":"hamster_wheel",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,0);return a.callReturn()}},hamster_set_led_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left, "LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Dropdown",options:[[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.HAMSTER_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]],value:"4",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_led_to"},paramsKeyMap:{DIRECTION:0,COLOR:1}, -"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=+a.getField("COLOR",a);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], +"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a),e=Number(a.getField("COLOR",a));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return a.callReturn()}},hamster_clear_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null,null],type:"hamster_clear_led"},paramsKeyMap:{DIRECTION:0},"class":"hamster_led",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("DIRECTION",a);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return a.callReturn()}},hamster_beep:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_beep"},"class":"hamster_buzzer",isNotFor:["hamster"], func:function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;c.buzzer=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return a}},hamster_change_buzzer_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", size:12}],events:{},def:{params:[{type:"text",params:["10"]},null],type:"hamster_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getNumberValue("VALUE");c.buzzer=void 0!=c.buzzer?c.buzzer+d:d;c.note=0;return a.callReturn()}},hamster_set_buzzer_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", params:["1000"]},null],type:"hamster_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue;c.buzzer=a.getNumberValue("VALUE");c.note=0;return a.callReturn()}},hamster_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"hamster_clear_buzzer"},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){var c= @@ -1571,16 +1572,16 @@ hamster_rest_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:" 1;var d=a.getNumberValue("VALUE"),d=6E4*d/Entry.Hamster.tempo;c.buzzer=0;c.note=0;var e=setTimeout(function(){a.timeFlag=0;Entry.Hamster.removeTimeout(e)},d);Entry.Hamster.timeouts.push(e);return a}},hamster_change_tempo_by:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["20"]},null],type:"hamster_change_tempo_by"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer", isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo+=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_tempo_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"hamster_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"hamster_buzzer",isNotFor:["hamster"],func:function(b,a){Entry.Hamster.tempo= a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}},hamster_set_port_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_analog_input,"0"],[Lang.Blocks.HAMSTER_digital_input,"1"],[Lang.Blocks.HAMSTER_servo_output,"8"],[Lang.Blocks.HAMSTER_pwm_output,"9"], -[Lang.Blocks.HAMSTER_digital_output,"10"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"hamster_set_port_to"},paramsKeyMap:{PORT:0,MODE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT",a),e=+a.getField("MODE",a);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return a.callReturn()}},hamster_change_output_by:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["10"]},null],type:"hamster_change_output_by"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE"); -"A"==d?c.outputA=void 0!=c.outputA?c.outputA+e:e:("B"!=d&&(c.outputA=void 0!=c.outputA?c.outputA+e:e),c.outputB=void 0!=c.outputB?c.outputB+e:e);return a.callReturn()}},hamster_set_output_to:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.HAMSTER_port_a,"A"],[Lang.Blocks.HAMSTER_port_b,"B"],[Lang.Blocks.HAMSTER_port_ab,"AB"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"hamster_set_output_to"},paramsKeyMap:{PORT:0,VALUE:1},"class":"hamster_port",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()}},is_clicked:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_is_clicked,color:"#3D3D3D"}],events:{},def:{params:[null],type:"is_clicked"}, -"class":"boolean_input",isNotFor:[],func:function(b,a){return Entry.stage.isClick}},is_press_some_key:{color:"#AEB8FF",skeleton:"basic_boolean_field",statements:[],params:[{type:"Keyboard",value:81},{type:"Text",text:Lang.Blocks.JUDGEMENT_is_press_some_key_2,color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"is_press_some_key"},paramsKeyMap:{VALUE:0},"class":"boolean_input",isNotFor:[],func:function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.pressedKeys.indexOf(c)}},reach_something:{color:"#AEB8FF", -skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"collision",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_JUDGE},{type:"Text",text:Lang.Blocks.JUDGEMENT_reach_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"reach_something"},paramsKeyMap:{VALUE:1},"class":"boolean_collision",isNotFor:[],func:function(b,a){if(!b.getVisible())return!1;var c=a.getField("VALUE", -a),d=b.object,e=/wall/.test(c),f=ndgmr.checkPixelCollision;if(e)switch(e=Entry.stage.wall,c){case "wall":if(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right,.2,!0))return!0;break;case "wall_up":if(f(d,e.up,.2,!0))return!0;break;case "wall_down":if(f(d,e.down,.2,!0))return!0;break;case "wall_right":if(f(d,e.right,.2,!0))return!0;break;case "wall_left":if(f(d,e.left,.2,!0))return!0}else{if("mouse"==c)return f=Entry.stage.canvas,f=d.globalToLocal(f.mouseX,f.mouseY),d.hitTest(f.x,f.y); -c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==b.type){f=c.object.getTransformedBounds();d=d.getTransformedBounds();if(Entry.checkCollisionRect(d,f))return!0;for(var c=c.parent.clonedEntities,e=0,g=c.length;e","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a); -return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d","BIGGER"]],value:"EQUAL",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null],type:"boolean_comparison"},paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND", +a);return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_bigger"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d}},boolean_smaller:{color:"#AEB8FF", skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"<",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]}],type:"boolean_smaller"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c","GREATER"],["<","LESS"],["\u2265","GREATER_OR_EQUAL"],["\u2264","LESS_OR_EQUAL"]],value:"EQUAL",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"text",params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},defs:[{params:[{type:"text", params:["10"]},"EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"GREATER_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"},{params:[{type:"text",params:["10"]},"LESS_OR_EQUAL",{type:"text",params:["10"]}],type:"boolean_basic_operator"}], -paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return+d>+e;case "LESS":return+d<+e;case "GREATER_OR_EQUAL":return+d>=+e;case "LESS_OR_EQUAL":return+d<=+e}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null], -type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown", -options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart= -!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS}, -{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}},remove_dialog:{color:"#EC4466",skeleton:"basic", -statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"change_to_nth_shape"}, -paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, -null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness:"blur"!=c&&"opacity"==c&& -(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect", -isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"},"class":"effect", -isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* +paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"boolean_compare",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getStringValue("LEFTHAND",a),e=a.getStringValue("RIGHTHAND",a);switch(c){case "EQUAL":return d==e;case "GREATER":return Number(d)>Number(e);case "LESS":return Number(d)=Number(e);case "LESS_OR_EQUAL":return Number(d)<=Number(e)}}},show:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"show"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!0);return a.callReturn()}},hide:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"hide"},"class":"visibility",isNotFor:[],func:function(b,a){b.setVisible(!1);return a.callReturn()}},dialog_time:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]],value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},{type:"number",params:["4"]},null,null],type:"dialog_time"},paramsKeyMap:{VALUE:0,SECOND:1,OPTION:2},"class":"say",isNotFor:["textBox"],func:function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a), +d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}},dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.speak,"speak"]], +value:"speak",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"text",params:[Lang.Blocks.block_hi]},null,null],type:"dialog"},paramsKeyMap:{VALUE:0,OPTION:1},"class":"say",isNotFor:["textBox"],func:function(b,a){var c=a.getStringValue("VALUE",a);c||"number"==typeof c||(c=" ");var d=a.getField("OPTION",a),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(b,c,d);b.syncDialogVisible(b.getVisible());return a.callReturn()}}, +remove_dialog:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"remove_dialog"},"class":"say",isNotFor:["textBox"],func:function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}},change_to_nth_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"pictures",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null, +null],type:"change_to_nth_shape"},paramsKeyMap:{VALUE:0},"class":"shape",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}},change_to_next_shape:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]],value:"next",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_LOOKS},{type:"Indicator",img:"block_icon/looks_03.png", +size:12}],events:{},def:{params:[null,null],type:"change_to_next_shape"},paramsKeyMap:{DRIECTION:0},"class":"shape",isNotFor:["textBox"],func:function(b,a){var c;c="prev"!==a.getStringField("DRIECTION")?b.parent.getNextPicture(b.picture.id):b.parent.getPrevPicture(b.picture.id);b.setImage(c);return a.callReturn()}},set_effect_volume:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity, +"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["10"]},null],type:"set_effect_volume"},paramsKeyMap:{EFFECT:0,VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d+b.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d+b.effect.brightness: +"blur"!=c&&"opacity"==c&&(b.effect.alpha+=d/100));b.applyFilter();return a.callReturn()}},set_effect:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]],value:"color",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["100"]},null],type:"set_effect"},paramsKeyMap:{EFFECT:0, +VALUE:1},"class":"effect",isNotFor:["textBox"],func:function(b,a){var c=a.getField("EFFECT",a),d=a.getNumberValue("VALUE",a);"color"==c?b.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?b.effect.brightness=d:"blur"!=c&&"opacity"==c&&(b.effect.alpha=d/100));b.applyFilter();return a.callReturn()}},erase_all_effects:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"erase_all_effects"}, +"class":"effect",isNotFor:["textBox"],func:function(b,a){b.resetFilter();return a.callReturn()}},change_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()* c);return a.callReturn()}},set_scale_percent:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_percent"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a)/100,d=b.snapshot_;b.setScaleX(c*d.scaleX);b.setScaleY(c*d.scaleY);return a.callReturn()}},change_scale_size:{color:"#EC4466", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}},set_scale_size:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/looks_03.png", size:12}],events:{},def:{params:[{type:"number",params:["100"]},null],type:"set_scale_size"},paramsKeyMap:{VALUE:0},"class":"scale",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()}},flip_y:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_y"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}},flip_x:{color:"#EC4466", @@ -1622,13 +1623,13 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",p img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY(); c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b,a){var c= -a.getField("VALUE",a);b.setRotation(b.getRotation()+ +c);return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", +a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic", statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[], params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_x:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, {type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(+c);b.setY(+d);b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", +{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);var d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3", a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dX=d/a.frameCount;a.dY=e/a.frameCount}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator", img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()- @@ -1642,10 +1643,10 @@ img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type: d)/Math.PI*180+270;d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+e-d);return a.callReturn()}},see_angle_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation(); b.setRotation(b.getRotation()+c-d);return a.callReturn()}},rotate_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_direction"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},locate_object_time:{color:"#A751E3", skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"locate_object_time"},paramsKeyMap:{VALUE:0,TARGET:1},"class":"move_absolute",isNotFor:[],func:function(b,a){if(!a.isStart){var c,d,e;d=a.getField("TARGET",a);c=a.getNumberValue("VALUE", -a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX),b.setY(b.getY()+ -a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c); -return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, +a);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-b.getX(),e=e.y-b.getY()):(e=Entry.container.getEntity(d),d=e.getX()-b.getX(),e=e.getY()-b.getY()),a.isStart=!0,a.frameCount=c,a.dX=d/a.frameCount,a.dY=e/a.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),b.setX(d),b.setY(e),b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a.callReturn()}if(0!=a.frameCount)return b.setX(b.getX()+a.dX), +b.setY(b.getY()+a.dY),a.frameCount--,b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY()),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_absolute:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE", +a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3",skeleton:"basic",statements:[], +params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"}, null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0, VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3", @@ -1874,7 +1875,7 @@ b.getMode())&&Entry.GlobalSvg.addControl(a);else if(g.code&&(b=e.block,d=b.getTh this._boardBlockView;if(a){this.workspace.getBoard();this._boardBlockView=null;var b=Entry.GlobalSvg.left,d=Entry.GlobalSvg.width/2,a=a.getBoard().offset().left;return bthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1