diff --git a/dist/entry.js b/dist/entry.js index b8085d19d8..df605ce2a0 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -358,7 +358,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 = Number(a.getField("COLOR", 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(); }; @@ -669,7 +669,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 = Number(a.getField("COLOR", 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(); }; @@ -778,7 +778,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 Number(d.responseText); + return +d.responseText; }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -1643,7 +1643,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() { 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); + return "x" === a.getField("VALUE", a) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y; }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1667,7 +1667,7 @@ Entry.block.coordinate_object = function(b, a) { var d = c.parent, d = d.pictures; return d.indexOf(c.picture) + 1; case "size": - return Number(c.getSize().toFixed(1)); + return +c.getSize().toFixed(1); case "picture_name": return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name; } @@ -2810,7 +2810,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 = Number(a.getField("SPEED", a)); + Entry.hw.sendQueue.lineTracerSpeed = +a.getField("SPEED", a); return a.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { @@ -2836,7 +2836,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 = Number(a.getField("COLOR", 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(); }; @@ -3035,7 +3035,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 = Number(a.getField("MODE", 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(); }; @@ -3084,7 +3084,7 @@ Blockly.Blocks.is_press_some_key = {init:function() { this.setInputsInline(!0); }}; Entry.block.is_press_some_key = function(b, a) { - var c = Number(a.getField("VALUE", a)); + var c = +a.getField("VALUE", a); return 0 <= Entry.pressedKeys.indexOf(c); }; Blockly.Blocks.reach_something = {init:function() { @@ -3298,13 +3298,13 @@ Entry.block.boolean_basic_operator = function(b, a) { case "EQUAL": return d == e; case "GREATER": - return Number(d) > Number(e); + return +d > +e; case "LESS": - return Number(d) < Number(e); + return +d < +e; case "GREATER_OR_EQUAL": - return Number(d) >= Number(e); + return +d >= +e; case "LESS_OR_EQUAL": - return Number(d) <= Number(e); + return +d <= +e; } }; Blockly.Blocks.show = {init:function() { @@ -3786,7 +3786,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() + Number(c)); + b.setRotation(b.getRotation() + +c); return a.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { @@ -3878,8 +3878,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(Number(c)); - b.setY(Number(d)); + b.setX(+c); + b.setY(+d); b.brush && !b.brush.stop && b.brush.lineTo(c, -1 * d); return a.callReturn(); }; @@ -4075,7 +4075,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 = 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(); + 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) { @@ -6861,12 +6861,14 @@ Entry.Dialog.prototype.generateSpeak = function() { this.update(); this.object.addChild(this.notch); this.object.addChild(b); + Entry.requestUpdate = !0; }; Entry.Dialog.prototype.update = function() { var b = this.parent.object.getTransformedBounds(), a = ""; -135 < b.y - this.height - 20 - this.border ? (this.object.y = b.y - this.height / 2 - 20 - this.padding, a += "n") : (this.object.y = b.y + b.height + this.height / 2 + 20 + this.padding, a += "s"); 240 > b.x + b.width + this.width ? (this.object.x = b.x + b.width + this.width / 2, a += "e") : (this.object.x = b.x - this.width / 2, a += "w"); this.notch.type != a && (this.object.removeChild(this.notch), this.notch = this.createSpeakNotch(a), this.object.addChild(this.notch)); + Entry.requestUpdate = !0; }; Entry.Dialog.prototype.createSpeakNotch = function(b) { var a = new createjs.Shape; @@ -7669,6 +7671,7 @@ Entry.EntityObject.prototype.resetFilter = function() { }; Entry.EntityObject.prototype.updateDialog = function() { this.dialog && this.dialog.update(); + Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.takeSnapshot = function() { this.snapshot_ = this.toJSON(); @@ -8167,7 +8170,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; g.onblur = function(a) { - isNaN(g.value) || c.entity.setX(Number(g.value)); + isNaN(g.value) || c.entity.setX(+g.value); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8175,7 +8178,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; k.onblur = function(a) { - isNaN(k.value) || c.entity.setY(Number(k.value)); + isNaN(k.value) || c.entity.setY(+k.value); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8183,7 +8186,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; n.onblur = function(a) { - isNaN(n.value) || c.entity.setSize(Number(n.value)); + isNaN(n.value) || c.entity.setSize(+n.value); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -8227,7 +8230,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(Number(a)); + isNaN(a) || c.entity.setRotation(+a); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8237,7 +8240,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(Number(a)); + isNaN(a) || c.entity.setDirection(+a); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -8309,24 +8312,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(Number(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(+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()); + 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(Number(g.value)), c.updateCoordinateView(), c.blur()); + 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(Number(k.value)), c.updateCoordinateView(), c.blur()); + 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(); @@ -10267,7 +10270,7 @@ Entry.Parser = function(b, a, c) { this.codeMirror = c; this._lang = a || "js"; this.availableCode = []; - "maze" === b && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); + "maze" === b && (this._stageId = +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": @@ -10971,7 +10974,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 = Number(b.getAttribute("id")); + 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)); @@ -11035,7 +11038,7 @@ p.getValue = function(b) { return this.values[b].run(); }; p.getNumberValue = function(b) { - return Number(this.values[b].run()); + return +this.values[b].run(); }; p.getStringValue = function(b) { return String(this.values[b].run()); @@ -11050,7 +11053,7 @@ p.getStringField = function(b) { return String(this.fields[b]); }; p.getNumberField = function(b) { - return Number(this.fields[b]); + return +this.fields[b]; }; p.callReturn = function() { return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; @@ -11642,7 +11645,7 @@ Entry.getElementsByClassName = function(b) { return a; }; Entry.parseNumber = function(b) { - return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b); + return "string" != typeof b || isNaN(+b) ? "number" != typeof b || isNaN(+b) ? !1 : b : +b; }; Entry.countStringLength = function(b) { var a, c = 0; @@ -11708,7 +11711,7 @@ Entry.computeInputWidth = function(b) { document.body.appendChild(a); b = a.offsetWidth; document.body.removeChild(a); - return Number(b + 10) + "px"; + return +(b + 10) + "px"; }; Entry.isArrowOrBackspace = function(b) { return -1 < [37, 38, 39, 40, 8].indexOf(b); @@ -11873,7 +11876,7 @@ Entry.getMaxFloatPoint = function(b) { 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); + return isNaN(b) || !this.isFloat(b) ? b : +(Math.round(b + "e" + a) + "e-" + a); }; Entry.attachEventListener = function(b, a, c) { setTimeout(function() { @@ -12237,7 +12240,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 = 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.template.function_param_string + (g ? g : ""), g++))) : e += k; + 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.template.function_param_string + (g ? g : ""), g++))) : e += k; } return {block:a, description:e}; }; @@ -12630,7 +12633,7 @@ p.removePortReadable = function(b) { var a, c; for (c in this.sendQueue.readablePorts) { if (this.sendQueue.readablePorts[c] == b) { - a = Number(c); + a = +c; break; } } @@ -13084,7 +13087,7 @@ Entry.Variable = function(b) { this._valueWidth = this._nameWidth = null; 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)) : "list" == this.type && (this.array_ = b.array ? b.array : []); + "slide" == this.type ? (this.minValue_ = +(b.minValue ? b.minValue : 0), this.maxValue_ = +(b.maxValue ? b.maxValue : 100)) : "list" == this.type && (this.array_ = b.array ? b.array : []); 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.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); }; Entry.Variable.prototype.generateView = function(b) { @@ -13260,13 +13263,13 @@ Entry.Variable.prototype.getId = function() { return this.id_; }; Entry.Variable.prototype.getValue = function() { - return this.isNumber() ? Number(this.value_) : this.value_; + 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 = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); + "slide" != this.type ? this.value_ = b : (b = +b, this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); this.isCloud_ && Entry.variableContainer.updateCloudVariables(); this._valueWidth = null; this.updateView(); @@ -13369,7 +13372,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 + Number(Math.abs(c - a) * b)).toFixed(2), b = parseFloat(b); + var a = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), b = (a + 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); @@ -14560,7 +14563,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) { c.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.setListLength = function(b) { - b = Number(b); + b = +b; var a = this.selectedList.array_; if (!isNaN(b)) { var c = a.length; @@ -15353,7 +15356,7 @@ Entry.BlockMenu = function(b, a, c, d) { if (isNaN(a)) { return a; } - a = Number(a); + a = +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--) { @@ -15720,7 +15723,7 @@ Entry.BlockView.DRAG_RADIUS = 5; var h = e[g].trim(); if (0 !== h.length) { if (d.test(h)) { - var k = Number(h.split("%")[1]) - 1, h = f[k], h = new Entry["Field" + h.type](h, this, k, a, g); + var k = +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 { @@ -16475,10 +16478,10 @@ Entry.Scope = function(b, a) { return String(this.getValue(a, b)); }; b.getNumberValue = function(a, b) { - return Number(this.getValue(a)); + return +this.getValue(a); }; b.getBooleanValue = function(a, b) { - return Number(this.getValue(a, b)) ? !0 : !1; + return +this.getValue(a, b) ? !0 : !1; }; b.getField = function(a, b) { return this.block.params[this._getParamIndex(a)]; @@ -16487,7 +16490,7 @@ Entry.Scope = function(b, a) { return String(this.getField(a)); }; b.getNumberField = function(a) { - return Number(this.getField(a)); + return +this.getField(a); }; b.getStatement = function(a, b) { return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); @@ -16670,7 +16673,7 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); }; b.applyValue = function() { var a = this.optionGroup.val(); - isNaN(a) || (a = this.modValue(a), this.setValue(a), this.updateGraph(), this.textElement.textContent = this.getValue(), this.optionGroup && this.optionGroup.val(a), this.resize()); + isNaN(a) || "" === a || (a = this.modValue(a), this.setValue(a), this.updateGraph(), this.textElement.textContent = this.getValue(), this.optionGroup && this.optionGroup.val(a), this.resize()); }; b.resize = function() { var a = this.getTextWidth(); @@ -19173,7 +19176,7 @@ Entry.Workspace.MODE_OVERLAYBOARD = 2; return this.mode; }; b.setMode = function(a, b) { - a = Number(a); + a = +a; var d = this.mode; this.mode = a; switch(a) { @@ -20201,7 +20204,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 Number(Entry.Xml.operate(b, c[d].children[0])); + return +Entry.Xml.operate(b, c[d].children[0]); } } return null; @@ -20224,7 +20227,7 @@ Entry.Xml.getNumberField = function(b, a) { } for (var d in c) { if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return Number(c[d].textContent); + return +c[d].textContent; } } }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 17edb3f544..28e0f584e0 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=Number(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=+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=Number(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=+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+ @@ -77,7 +77,7 @@ Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appe 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 Number(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+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(" "); @@ -182,10 +182,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)?Number(Entry.stage.mouseCoordinate.x):Number(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)?+Entry.stage.mouseCoordinate.x:+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 Number(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+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)}}; @@ -305,10 +305,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=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_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_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=Number(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=+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}; @@ -329,12 +329,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=Number(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=+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=Number(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=+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 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()}; +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()}; 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)}}; @@ -401,7 +401,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()+Number(c));return a.callReturn()}; +Entry.block.rotate_by_angle_dropdown=function(b,a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+ +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)}}; @@ -413,7 +413,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(Number(c));b.setY(Number(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(+c);b.setY(+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()}; @@ -439,8 +439,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=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()}; +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()}; 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)}}; @@ -720,10 +720,11 @@ Entry.SVG.createElement=function(b,a){var c;c="string"===typeof b?document.creat Entry.SVG.attr=function(b,a){if("string"===typeof b){var c={};c[b]=a;b=c}if(b){b.href&&(this.setAttributeNS(Entry.SVG.NS_XLINK,"href",b.href),delete b.href);for(var d in b)this.setAttribute(d,b[d])}return this};Entry.SVG.addClass=function(b){for(var a=this.getAttribute("class"),c=0;cb.x+b.width+this.width?(this.object.x=b.x+b.width+this.width/2,a+="e"):(this.object.x=b.x-this.width/2,a+="w");this.notch.type!=a&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(a),this.object.addChild(this.notch))}; -Entry.Dialog.prototype.createSpeakNotch=function(b){var a=new createjs.Shape;a.type=b;"ne"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0,this.height+this.padding-1.5).lt(-10,this.height+this.padding+20).lt(20,this.height+this.padding-1.5):"nw"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,this.height+this.padding-1.5).lt(this.width+10,this.height+this.padding+20).lt(this.width-20,this.height+this.padding-1.5):"se"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0, --this.padding+1.5).lt(-10,-this.padding-20).lt(20,-this.padding+1.5):"sw"==b&&a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,-this.padding+1.5).lt(this.width+10,-this.padding-20).lt(this.width-20,-this.padding+1.5);return a};Entry.Dialog.prototype.remove=function(){Entry.stage.unloadDialog(this);this.parent.dialog=null};Entry.DoneProject=function(b){this.generateView(b)};var p=Entry.DoneProject.prototype;p.init=function(b){this.projectId=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerDoneWorkspace");this.doneContainer=a;var c=Entry.createElement("iframe");c.setAttribute("id","doneProjectframe");c.setAttribute("frameborder",0);c.setAttribute("src","/api/iframe/project/"+b);this.doneProjectFrame=c;this.doneContainer.appendChild(c);a.addClass("entryRemove")};p.getView=function(){return this.doneContainer}; +c;this.notch=this.createSpeakNotch("ne");this.update();this.object.addChild(this.notch);this.object.addChild(b);Entry.requestUpdate=!0}; +Entry.Dialog.prototype.update=function(){var b=this.parent.object.getTransformedBounds(),a="";-135b.x+b.width+this.width?(this.object.x=b.x+b.width+this.width/2,a+="e"):(this.object.x=b.x-this.width/2,a+="w");this.notch.type!=a&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(a),this.object.addChild(this.notch));Entry.requestUpdate= +!0}; +Entry.Dialog.prototype.createSpeakNotch=function(b){var a=new createjs.Shape;a.type=b;"ne"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0,this.height+this.padding-1.5).lt(-10,this.height+this.padding+20).lt(20,this.height+this.padding-1.5):"nw"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,this.height+this.padding-1.5).lt(this.width+10,this.height+this.padding+20).lt(this.width-20,this.height+this.padding-1.5):"se"==b?a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(0,-this.padding+ +1.5).lt(-10,-this.padding-20).lt(20,-this.padding+1.5):"sw"==b&&a.graphics.f("#f5f5f5").ss(2,"round").s("#6FC0DD").mt(this.width,-this.padding+1.5).lt(this.width+10,-this.padding-20).lt(this.width-20,-this.padding+1.5);return a};Entry.Dialog.prototype.remove=function(){Entry.stage.unloadDialog(this);this.parent.dialog=null};Entry.DoneProject=function(b){this.generateView(b)};var p=Entry.DoneProject.prototype;p.init=function(b){this.projectId=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerDoneWorkspace");this.doneContainer=a;var c=Entry.createElement("iframe");c.setAttribute("id","doneProjectframe");c.setAttribute("frameborder",0);c.setAttribute("src","/api/iframe/project/"+b);this.doneProjectFrame=c;this.doneContainer.appendChild(c);a.addClass("entryRemove")};p.getView=function(){return this.doneContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("doneProjectframe"),a=this.doneContainer.offsetWidth;b.width=a+"px";b.height=9*a/16+"px"};Entry.Engine=function(){function b(a){var b=[37,38,39,40,32],d=a.keyCode||a.which,e=Entry.stage.inputField;32==d&&e&&e.hasFocus()||-1=l?g=[1,0,0,0,0,0,k,h,0,0,0,-1*h,k,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=l?g=[k,0,h,0,0,0,1,0,0,0,h,0,k,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=l&&(g=[k,h,0,0,0,-1*h,k,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);g=(new createjs.ColorMatrix).concat(g);g=new createjs.ColorMatrixFilter(g);e.push(g);b.alpha=a.alpha=f(a.alpha,0,1);b.filters=e}(b,a),a.cache(0,0,this.getWidth(), -this.getHeight()),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.resetFilter=function(){"sprite"==this.parent.objectType&&(this.object.filters=[],this.setInitialEffectValue(),this.object.alpha=this.effect.alpha,this.object.cache(0,0,this.getWidth(),this.getHeight()),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.updateDialog=function(){this.dialog&&this.dialog.update()};Entry.EntityObject.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON();this.collision=Entry.Utils.COLLISION.NONE}; -Entry.EntityObject.prototype.loadSnapshot=function(){this.snapshot_&&this.syncModel_(this.snapshot_);"sprite"==this.parent.objectType&&this.setImage(this.parent.getPicture());Entry.requestUpdate=!0};Entry.EntityObject.prototype.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var b=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(b,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}}; -Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; +this.getHeight()),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.resetFilter=function(){"sprite"==this.parent.objectType&&(this.object.filters=[],this.setInitialEffectValue(),this.object.alpha=this.effect.alpha,this.object.cache(0,0,this.getWidth(),this.getHeight()),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.updateDialog=function(){this.dialog&&this.dialog.update();Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON();this.collision=Entry.Utils.COLLISION.NONE};Entry.EntityObject.prototype.loadSnapshot=function(){this.snapshot_&&this.syncModel_(this.snapshot_);"sprite"==this.parent.objectType&&this.setImage(this.parent.getPicture());Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var b=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(b,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}};Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; Entry.EntityObject.prototype.toJSON=function(){var b={};b.x=Entry.cutDecimal(this.getX());b.y=Entry.cutDecimal(this.getY());b.regX=Entry.cutDecimal(this.getRegX());b.regY=Entry.cutDecimal(this.getRegY());b.scaleX=this.getScaleX();b.scaleY=this.getScaleY();b.rotation=Entry.cutDecimal(this.getRotation());b.direction=Entry.cutDecimal(this.getDirection());b.width=Entry.cutDecimal(this.getWidth());b.height=Entry.cutDecimal(this.getHeight());b.font=this.getFont();b.visible=this.getVisible();"textBox"== this.parent.objectType&&(b.colour=this.getColour(),b.text=this.getText(),b.textAlign=this.getTextAlign(),b.lineBreak=this.getLineBreak(),b.bgColor=this.getBGColour(),b.underLine=this.getUnderLine(),b.strike=this.getStrike(),b.fontSize=this.getFontSize());return b};Entry.EntityObject.prototype.setInitialEffectValue=function(){this.effect=this.getInitialEffectValue();Entry.requestUpdate=!0}; Entry.EntityObject.prototype.getInitialEffectValue=function(){return{blur:0,hue:0,hsv:0,brightness:0,contrast:0,saturation:0,alpha:1}};Entry.EntityObject.prototype.removeBrush=function(){Entry.stage.selectedObjectContainer.removeChild(this.shape);this.shape=this.brush=null}; @@ -823,11 +824,11 @@ this.nameView_.onkeypress=function(a){13==a.keyCode&&f.editObjectValues(!1)};thi d.blur=function(b){a.editObjectComplete()}):d.addClass("entryRemove");Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeleteWorkspace"),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(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"); +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(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"); +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)}}, @@ -835,13 +836,13 @@ this.updateRotationView(!0);return this.view_}if("phone"==Entry.type)return b=En 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}; +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())}; 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}; @@ -1003,7 +1004,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");$(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=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));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 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;c/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;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: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.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:+(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", @@ -1142,7 +1143,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=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.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.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.6_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.Stage=function(){this.variables={};this.background=new createjs.Shape;this.background.graphics.beginFill("#ffffff").drawRect(-480,-240,960,480);this.objectContainers=[];this.selectedObjectContainer=null;this.variableContainer=new createjs.Container;this.dialogContainer=new createjs.Container;this.selectedObject=null;this.isObjectClick=!1}; @@ -1198,8 +1199,8 @@ Entry.Stage.prototype.selectObjectContainer=function(b){if(this.canvas){for(var Entry.Stage.prototype.reAttachToCanvas=function(){for(var b=[this.selectedObjectContainer,this.variableContainer,this.coordinator,this.handle,this.dialogContainer],a=0;athis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;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.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this._nameWidth=null;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._valueWidth=null;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_add;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; @@ -1329,7 +1330,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=+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(){})}}; @@ -1398,7 +1399,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=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"}, +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"}, 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= @@ -1415,13 +1416,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=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", +"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", "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 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", +!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", 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])}}, @@ -1481,17 +1482,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)?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, +"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, "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, @@ -1559,11 +1560,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=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, +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, "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=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"], +"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"], 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= @@ -1574,16 +1575,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=Number(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=Number(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 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)}if(0==a.timeFlag)return delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn();b.dialog||(d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(b, -d,e),b.syncDialogVisible(b.getVisible()));return 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",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_x"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}},set_object_order:{color:"#EC4466",skeleton:"basic",statements:[], -params:[{type:"DropdownDynamic",value:null,menuName:"objectSequence",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"set_object_order"},paramsKeyMap:{VALUE:0},"class":"z-index",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1+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)}if(0==a.timeFlag)return delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn();b.dialog||(d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(b,d,e),b.syncDialogVisible(b.getVisible()));return 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",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null],type:"flip_x"},"class":"flip",isNotFor:[],func:function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}},set_object_order:{color:"#EC4466",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic", +value:null,menuName:"objectSequence",fontSize:11},{type:"Indicator",img:"block_icon/looks_03.png",size:12}],events:{},def:{params:[null,null],type:"set_object_order"},paramsKeyMap:{VALUE:0},"class":"z-index",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1d&&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()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.UP):(e=b.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,b.object,0,!1),!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE),f&& @@ -1645,8 +1646,8 @@ Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{col "mouse"==c?(c=Entry.stage.mouseCoordinate.y,d=Entry.stage.mouseCoordinate.x-d,e=c-e):(c=Entry.container.getEntity(c),d=c.getX()-d,e=c.getY()-e);e=0===d&&0===e?b.getDirection()+b.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/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=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", +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"},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"}, @@ -1892,7 +1893,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);-1b;b+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0===b%45?10:5),y2:0,transform:"rotate("+b+", 0, 0)",class:"entry-angle-divider"});b=this.getAbsolutePosFromBoard();b.x+=this.box.width/ 2;b.y=b.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+b.x+","+b.y+")"});var b=a.getAbsolutePosFromDocument(),d=[b.x+a.box.width/2,b.y+a.box.height/2+1];$(this.svgOptionGroup).mousemove(function(b){a.optionGroup.val(a.modValue(function(a,b){var c=b[0]-a[0],d=b[1]-a[1]-49-1,e=Math.atan(-d/c),e=Entry.toDegrees(e),e=90-e;0>c?e+=180:0Math.PI?1:0;this._fillPath=this.svgOptionGroup.elem("path",{d:"M 0,0 v -49 A 49,49 0 %LARGE 1 %X,%Y z".replace("%X",b).replace("%Y",d).replace("%LARGE",a),class:"entry-angle-fill-area"});this.svgOptionGroup.appendChild(this._dividerGroup);this._indicator&&this._indicator.remove();this._indicator=this.svgOptionGroup.elem("line",{x1:0,y1:0,x2:b,y2:d});this._indicator.attr({class:"entry-angle-indicator"})}; -b.applyValue=function(){var a=this.optionGroup.val();isNaN(a)||(a=this.modValue(a),this.setValue(a),this.updateGraph(),this.textElement.textContent=this.getValue(),this.optionGroup&&this.optionGroup.val(a),this.resize())};b.resize=function(){var a=this.getTextWidth();this._header.attr({width:a});this.optionGroup&&this.optionGroup.css({width:a});this.box.set({width:a});this._block.view.alignContent()};b.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+8:8};b.getText= -function(){return this.getValue()+"\u00b0"};b.modValue=function(a){return a%360};b.destroyOption=function(){this.disposeEvent&&(Entry.disposeEvent.detach(this.disposeEvent),delete this.documentDownEvent);this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.svgOptionGroup&&(this.svgOptionGroup.remove(),delete this.svgOptionGroup);this.textElement.textContent=this.getText();this.command()}})(Entry.FieldAngle.prototype);Entry.FieldBlock=function(b,a,c,d,e){Entry.Model(this,!1);this._blockView=a;this._block=a.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=b;this.acceptType=b.accept;this._restoreCurrent=b.restore;this.view=this;this.svgGroup=null;this._position=b.position;this.box.observe(a,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(a.getBoard(),d)}; +b.applyValue=function(){var a=this.optionGroup.val();isNaN(a)||""===a||(a=this.modValue(a),this.setValue(a),this.updateGraph(),this.textElement.textContent=this.getValue(),this.optionGroup&&this.optionGroup.val(a),this.resize())};b.resize=function(){var a=this.getTextWidth();this._header.attr({width:a});this.optionGroup&&this.optionGroup.css({width:a});this.box.set({width:a});this._block.view.alignContent()};b.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+ +8:8};b.getText=function(){return this.getValue()+"\u00b0"};b.modValue=function(a){return a%360};b.destroyOption=function(){this.disposeEvent&&(Entry.disposeEvent.detach(this.disposeEvent),delete this.documentDownEvent);this.optionGroup&&(this.optionGroup.remove(),delete this.optionGroup);this.svgOptionGroup&&(this.svgOptionGroup.remove(),delete this.svgOptionGroup);this.textElement.textContent=this.getText();this.command()}})(Entry.FieldAngle.prototype);Entry.FieldBlock=function(b,a,c,d,e){Entry.Model(this,!1);this._blockView=a;this._block=a.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=b;this.acceptType=b.accept;this._restoreCurrent=b.restore;this.view=this;this.svgGroup=null;this._position=b.position;this.box.observe(a,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(a.getBoard(),d)}; Entry.Utils.inherit(Entry.Field,Entry.FieldBlock); (function(b){b.schema={magneting:!1};b.renderStart=function(a,b){this.svgGroup=this._blockView.contentSvgGroup.elem("g");this.view=this;this._nextGroup=this.svgGroup;this.box.set({x:0,y:0,width:0,height:20});var d=this.getValue();d&&!d.view&&(d.setThread(this),d.createView(a,b),d.getThread().view.setParent(this));this.updateValueBlock(d);this._blockView.getBoard().constructor!==Entry.Board&&this._valueBlock.view.removeControl()};b.align=function(a,b,d){var e=this.svgGroup;this._position&&(this._position.x&& (a=this._position.x),this._position.y&&(b=this._position.y));var f=this._valueBlock;f&&(b=-.5*f.view.height);f="translate("+a+","+b+")";void 0===d||d?e.animate({transform:f},300,mina.easeinout):e.attr({transform:f});this.box.set({x:a,y:b})};b.calcWH=function(){var a=this._valueBlock;a?(a=a.view,this.box.set({width:a.width,height:a.height})):this.box.set({width:15,height:20})};b.calcHeight=b.calcWH;b.destroy=function(){};b.inspectBlock=function(){var a=null;if(this._originBlock)a=this._originBlock.type, @@ -2112,7 +2113,7 @@ rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(b,{duration:50}) function d(a){e.codeMirror.display.dragFunctions.over(a)}var e;this.view=Entry.Dom("div",{parent:a,class:"entryVimBoard"});this.codeMirror=CodeMirror(this.view[0],{lineNumbers:!0,value:"",mode:{name:"javascript",globalVars:!0},theme:"default",indentUnit:4,styleActiveLine:!0,extraKeys:{"Ctrl-Space":"javascriptComplete",Tab:function(a){var b=Array(a.getOption("indentUnit")+1).join(" ");a.replaceSelection(b)}},lint:!0,viewportMargin:10});this.doc=this.codeMirror.getDoc();e=this;a=this.view[0];a.removeEventListener("dragEnd", b);a.removeEventListener("dragOver",d);a.addEventListener("dragEnd",b);a.addEventListener("dragOver",d)};b.hide=function(){this.view.addClass("entryRemove")};b.show=function(){this.view.removeClass("entryRemove")};b.textToCode=function(){var a=this.codeMirror.getValue(),a=this._parser.parse(a);if(0===a.length)throw"\ube14\ub85d \ud30c\uc2f1 \uc624\ub958";return a};b.codeToText=function(a){a=this._blockParser.parse(a);this.codeMirror.setValue(a)};b.getCodeToText=function(a){return this._blockParser.parse(a)}})(Entry.Vim.prototype);Entry.Workspace=function(b){Entry.Model(this,!1);this.observe(this,"_handleChangeBoard",["selectedBoard"],!1);this.trashcan=new Entry.FieldTrashcan;var a=b.blockMenu;a&&(this.blockMenu=new Entry.BlockMenu(a.dom,a.align,a.categoryData,a.scroll),this.blockMenu.workspace=this,this.blockMenu.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1));if(a=b.board)a.workspace=this,this.board=new Entry.Board(a),this.board.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1),this.set({selectedBoard:this.board}); if(a=b.vimBoard)this.vimBoard=new Entry.Vim(a.dom),this.vimBoard.workspace=this;this.board&&this.vimBoard&&this.vimBoard.hide();Entry.GlobalSvg.createDom();this.mode=Entry.Workspace.MODE_BOARD;Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl);this.changeEvent=new Entry.Event(this);Entry.commander.setCurrentEditor("board",this.board)};Entry.Workspace.MODE_BOARD=0;Entry.Workspace.MODE_VIMBOARD=1;Entry.Workspace.MODE_OVERLAYBOARD=2; -(function(b){b.schema={selectedBlockView:null,selectedBoard:null};b.getBoard=function(){return this.board};b.getSelectedBoard=function(){return this.selectedBoard};b.getBlockMenu=function(){return this.blockMenu};b.getVimBoard=function(){return this.vimBoard};b.getMode=function(){return this.mode};b.setMode=function(a,b){a=Number(a);var d=this.mode;this.mode=a;switch(a){case d:return;case Entry.Workspace.MODE_VIMBOARD:this.board&&this.board.hide();this.overlayBoard&&this.overlayBoard.hide();this.set({selectedBoard:this.vimBoard}); +(function(b){b.schema={selectedBlockView:null,selectedBoard:null};b.getBoard=function(){return this.board};b.getSelectedBoard=function(){return this.selectedBoard};b.getBlockMenu=function(){return this.blockMenu};b.getVimBoard=function(){return this.vimBoard};b.getMode=function(){return this.mode};b.setMode=function(a,b){a=+a;var d=this.mode;this.mode=a;switch(a){case d:return;case Entry.Workspace.MODE_VIMBOARD:this.board&&this.board.hide();this.overlayBoard&&this.overlayBoard.hide();this.set({selectedBoard:this.vimBoard}); this.vimBoard.show();this.vimBoard.codeToText(this.board.code);this.blockMenu.renderText();this.board.clear();break;case Entry.Workspace.MODE_BOARD:try{this.board.show(),this.set({selectedBoard:this.board}),this.textToCode(d),this.vimBoard&&this.vimBoard.hide(),this.overlayBoard&&this.overlayBoard.hide(),this.blockMenu.renderBlock()}catch(e){throw this.board&&this.board.hide(),this.set({selectedBoard:this.vimBoard}),Entry.dispatchEvent("setProgrammingMode",Entry.Workspace.MODE_VIMBOARD),e;}Entry.commander.setCurrentEditor("board", this.board);break;case Entry.Workspace.MODE_OVERLAYBOARD:this.overlayBoard||this.initOverlayBoard(),this.overlayBoard.show(),this.set({selectedBoard:this.overlayBoard}),Entry.commander.setCurrentEditor("board",this.overlayBoard)}this.changeEvent.notify(b)};b.changeBoardCode=function(a){this.board.changeCode(a)};b.changeOverlayBoardCode=function(a){this.overlayBoard&&this.overlayBoard.changeCode(a)};b.changeBlockMenuCode=function(a){this.blockMenu.changeCode(a)};b.textToCode=function(a){if(a==Entry.Workspace.MODE_VIMBOARD){a= this.vimBoard.textToCode();var b=this.board,d=b.code;d.load(a);d.createView(b);b.reDraw();this.board.alignThreads()}};b.codeToText=function(a){return this.vimBoard.codeToText(a)};b.getCodeToText=function(a){return this.vimBoard.getCodeToText(a)};b._setSelectedBlockView=function(){this.set({selectedBlockView:this.board.selectedBlockView||this.blockMenu.selectedBlockView||(this.overlayBoard?this.overlayBoard.selectedBlockView:null)})};b.initOverlayBoard=function(){this.overlayBoard=new Entry.Board({dom:this.board.view, @@ -2196,7 +2197,7 @@ Entry.Playground.prototype.setFontAlign=function(b){if("textBox"==this.object.ob Entry.Playground.prototype.hideBlockMenu=function(){this.mainWorkspace.getBlockMenu().hide()};Entry.Playground.prototype.showBlockMenu=function(){this.mainWorkspace.getBlockMenu().show()};Entry.Xml={};Entry.Xml.isTypeOf=function(b,a){return a.getAttribute("type")==b};Entry.Xml.getNextBlock=function(b){b=b.childNodes;for(var a=0;a